-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distinguishing between different null types #143
Comments
I'm a bit hesitant to introduce too many edge cases/constructs here as these are intended as more of a "starter type" where maybe it's usable out of the box, maybe it needs a bit of editing to be used efficiently. @quinnj what do you think? Relatedly, using JSON3
using StructTypes
struct MyType
a::Some{Int}
end
StructTypes.StructType(::Type{MyType}) = StructTypes.Struct()
json = """{"a": null}"""
JSON3.read(json, MyType)
# ^ ERROR: ArgumentError: Some{Int64} doesn't have a defined `StructTypes.StructType` |
Hmmm, yeah, I think I agree with @mcmcgrath13 that the type generating machinery is really about getting a good "start" to generating types and not really getting it perfect. The produced files are easily editable. Yeah, maybe we need to add support for |
Brought up in quinnj/JSON3.jl#143. This is basically the exact use-case for `CustomStruct`.
Ok, support for |
* Define StructType for Some as CustomStruct Brought up in quinnj/JSON3.jl#143. This is basically the exact use-case for `CustomStruct`. * fix tests
Currently, these is only one type of null in the code generator. The following code
produces this struct
This is only because the field
a
does not have enough samples to produce a meaningful type. On the other hand, the values inb
are typical in JSON and would be nice to represent with "the software engineer's null" (JuliaLang/julia#22682). I would like the code generator to output something likeor
The text was updated successfully, but these errors were encountered: