Skip to content
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

Support UnorderedStruct #19

Open
chris-b1 opened this issue Oct 25, 2021 · 0 comments
Open

Support UnorderedStruct #19

chris-b1 opened this issue Oct 25, 2021 · 0 comments

Comments

@chris-b1
Copy link

xref quinnj/JSON3.jl#113 & JuliaData/StructTypes.jl#35

I think Strapping should follow the behavior of JSON3 with respect to Ordered / Unordered? Simple repro below

import StructTypes
import Strapping

struct Person
    name::String
    id::Int
end
StructTypes.StructType(::Type{Person}) = StructTypes.UnorderedStruct()  # aka StructTypes.Struct()

julia> Strapping.construct(Person, [(; name="Bob", id=1)])
Person("Bob", 1)

julia> Strapping.construct(Person, [(; id=1, name="Bob")])
ERROR: MethodError: no method matching String(::Int64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant