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

null is not deserialized correctly #33

Open
notgne2 opened this issue Jan 16, 2020 · 3 comments
Open

null is not deserialized correctly #33

notgne2 opened this issue Jan 16, 2020 · 3 comments

Comments

@notgne2
Copy link

notgne2 commented Jan 16, 2020

Using this with Podman will result in invalid type: null, expected a sequence on many endpoints, as empty lists are omitted in favor of null.

I'm not sure if this is an issue in my usage or some change within Serde.

@haraldh
Copy link
Collaborator

haraldh commented Jan 22, 2020

Can you point me to the varlink structs which have the problem?
Normally "null" means None, and the struct field should be an Option/nullable denoted with a ?.

type MyType (
   example_nullable_array: ?[]string,
   example_nullable_dictionary: ?[string]string,
   example_nullable_stringset: ?[string](),
   example_nullable_array_struct: ?[](first: int, second: string)
)

@haraldh
Copy link
Collaborator

haraldh commented Jan 22, 2020

The rust varlink generator will produce a #[serde(skip_serializing_if = "Option::is_none")] in this case

@notgne2
Copy link
Author

notgne2 commented Jan 24, 2020

Podman's varlink implementation often gives null in place of an empty array (they use optional arrays too in other places, but those of course work fine). The CLI will reveal this just fine, showing null in place of the array whenever it is empty, but of course other usage will expect a specific type and produce an error.

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