Skip to content

Add a way to unset an input property #29

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

Merged
merged 5 commits into from
Sep 7, 2017
Merged

Conversation

BenEmdon
Copy link
Contributor

@BenEmdon BenEmdon commented Sep 6, 2017

This PR

In this PR I am adding a way to unset properties so that they aren't serialized. This change is required because currently there is no way to tell a property to not serialize.
This is aimed to help consumers of this generator that were effected by the change #28 that used to reset their input types with inputType.setProperty(null) so that they can use inputType.unsetProperty() instead.

  • Generated supporting schema
  • Added tests
  • Change results in no API breakage

@@ -286,6 +286,12 @@ public class <%= schema_name %> {
this.<%= escape_reserved_word(field.camelize_name) %> = <%= escape_reserved_word(field.camelize_name) %>;
return this;
}

// Unsets the <%= escape_reserved_word(field.camelize_name) %> property so that it is not serialized
public void unset<%= field.classify_name %>() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to have this method for required fields, as is the case here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense so I fixed this.
This comment was on the optional field generator ☝️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originally the comment was for required fields, but github moved it after that got removed.

@wesleyjellis
Copy link

This looks good, but the test failures seem to be legitimate

@BenEmdon BenEmdon merged commit cb786c4 into master Sep 7, 2017
@BenEmdon BenEmdon deleted the clear-nullable-input branch September 7, 2017 14:06
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