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

Deserialize union in CaseKeyAsFieldValue mode from JSON with more than 2 fields #41

Open
megafinz opened this issue Aug 24, 2020 · 5 comments

Comments

@megafinz
Copy link
Contributor

Is there any particular reason for this check in deserializeUnion?

if fields.Length <> 2 then
    failDeserialization path <| sprintf "Failed to parse union from record with %i fields, should be 2 fields." fields.Length

I have a JSON with more than two fields but I care just for the key field (union case discriminator) and the value field.

{
    "ignore_this": "yes",
    "ignore_that": "also yes",
    ...,
    "discriminator": "type_1",
    "data": {
        ...
    }
}
@vsapronov
Copy link
Collaborator

vsapronov commented Aug 24, 2020

Does data in your example depend on discriminator? You refer to some "value field" that is not in your example (I'm assuming you meant data field).

@megafinz
Copy link
Contributor Author

Yes, sorry, data is the value field (CaseValueField = "data").

@vsapronov
Copy link
Collaborator

Hmmm, actually from the code it seems that we can safely lift this limitation for number of fields in the object.

@vsapronov
Copy link
Collaborator

Thank you I will let you know here in what release the change is available

@megafinz
Copy link
Contributor Author

Thanks!

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

2 participants