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

Allow Sets and Lists to be initialized to null (instead of an empty collection) #203

Merged
merged 1 commit into from
Jun 10, 2014

Conversation

Illapikov
Copy link

You should use 'initializeEmptyCollections' set to false to get null to list.

You should use 'initializeEmptyCollections' set to false to get null to list.
@joelittlejohn joelittlejohn added this to the 0.4.4 milestone Jun 10, 2014
joelittlejohn added a commit that referenced this pull request Jun 10, 2014
Introduce new option to init all collections with null

Closes #201
@joelittlejohn joelittlejohn merged commit 1aa0c28 into joelittlejohn:master Jun 10, 2014
@joelittlejohn joelittlejohn changed the title Introduce new option to init all collections with null Allow Sets and Lists to be initialized to null (instead of an empty collection) Jun 10, 2014
@dimas
Copy link

dimas commented Jun 11, 2014

Guys, this is a super feature but why the property is called initializeEmptyCollections? It sounds like "if a collection is empty - initialize it".
It feels like the name should be initializeCollectionsEmpty instead (which reads "initialize collections making them empty").

(I am not a native speaker so, obviously can be wrong)

Also it feels like a test is missing. I am not sure about jsonschema2pojo test policy but I personally would test it.

Thanks

@joelittlejohn
Copy link
Owner

Good point. How about simple initializeCollections? I think it's pretty obvious that 'initialize' implies that we will assign an instance (rather than null), and that for collections those instances will be empty if there are no default values supplied.

Regarding the test, good spot @dimas thank you. Somehow the integration test has been lost as the PR was prepared. There is a full set of integration tests in Illapikov/jsonschema2pojo@953c1012a4863275776352ce1bc0f1f74c80a5e1 and I didn't notice that this file was missing from the PR. @Illapikov don't worry about making any further changes, I'll grab the missing InitializeCollectionWithNullIT from that commit and add it to the project.

@dimas
Copy link

dimas commented Jun 11, 2014

"initializeCollections" is even better.

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

Successfully merging this pull request may close these issues.

3 participants