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

Skip_when_empty: Unobvious serialization behaviour | update docs #1314

Open
Khairullin opened this issue Apr 23, 2021 · 1 comment
Open

Skip_when_empty: Unobvious serialization behaviour | update docs #1314

Khairullin opened this issue Apr 23, 2021 · 1 comment

Comments

@Khairullin
Copy link

Q A
Bug report? no
Feature request? no
Doc updated? yes
Unobvious behaviour? yes

Steps required to reproduce the problem

  1. Create model class at least with one array field, initialize it with [], just when declaring field.
  2. Write yaml config for model class, with xml_list option for array field
  3. Post some test data and try to serialize it into xml format.
  4. xml-tag for empty array abscent, it was skipped by default.
  5. Try to serialize to json-format. json-field with empty array is present

Expected Result

Same behaviour for json and xml serialization for same yaml config. "skip_when_empty" option mentioned in docs as "allowed inside xml_list"

Actual Result

Serialization behaviour differs. No info in docs about "skip_when_empty" inside "xml_list", even in examples.

@goetas
Copy link
Collaborator

goetas commented Aug 6, 2021

you are right "skip_when_empty" works well only for json. if you are interested to make it work for php, it would be great

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