Repository navigation
Resolve types like we already do for enums - #26
Conversation
CarlOlsson
left a comment
There was a problem hiding this comment.
The only comment from Codex, I guess not a blocker for this PR:
One round-trip edge case: binding_tag can write external module tags that resolve_name cannot load from the same base_module.
Example: if a package writes with base_module = MyPackage and an artifact contains a Dates.Date, the tag becomes:
type: Dates.DateBut loading with base_module = MyPackage tries to resolve that as MyPackage.Dates.Date, so it fails unless Dates is bound inside MyPackage.
So the new base_module behavior works for package-local types, but external dependency types may not round-trip unless those modules are imported into the base module. This probably needs either a resolver tweak or an explicit test/docs note for that limitation.
Maybe I don't understand what you're saying here, but this is what the new unit test ("base_module type tags") is all about. There's an Here's a simpler example: So that roundtrips perfectly. And just to be sure, you can also exit Julia, start a new one, define those same modules, and then call I think Codex missed on this one, or I'm misunderstanding the problem. |
|
From Codex: Thanks, I think your example and the new test cover the For example: import YAML
import PortableStructs
import Dates
module C
end
x = Dates.Date(2026, 6, 24)
PortableStructs.write_to_yaml("c.yaml", x; base_module = C)
println(read("c.yaml", String))
PortableStructs.load_from_yaml("c.yaml"; base_module = C)This writes a tag rooted at type: "Dates.Date"But on load, So I agree that |
|
Ok, good call. I believe this fixes it. |
This allows a package to read/write YAML/JSON using names relative to a given module rather than (implicitly) assuming everything is available from
Main.This is actually a small, non-breaking change. It's well tested and works with heavier downstream use cases.
See the updated readme.md.