You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment it's a little messy with creating new instances of the POJOs with the builders. Could we get an option that would create an additional constructor to define the required fields?
Right now to create something of the following schema:
Obj { name: asdf, age: 32; state:NC}
You would have to invoke it by: (with builders enabled)
new Obj().withName("asdf").withAge(32).withState("NC")
Rather than [what I'm suggesting]
new Obj("asdf", 32, "NC")
The text was updated successfully, but these errors were encountered:
I was just about to raise an issue similar to this. JSON-Schema (Validation) has the "required" keyword to signify which fields are mandatory for a schema object.
It would probably make sense support that rather than just adding an epic constructor with all fields.
Interestingly, I originally had "required": true" against each property in my schemas, however I see that required is not mentioned in the core JSON-Schema spec, tho jsonschema2java generates @NotNull annotations for those? That should probably also change. It looks like this may have changed in the draft-03 spec..
joelittlejohn
changed the title
Option to create a constructor with all of the required fields
Option to create constructors (with all fields, or with required fields)
Feb 9, 2015
At the moment it's a little messy with creating new instances of the POJOs with the builders. Could we get an option that would create an additional constructor to define the required fields?
Right now to create something of the following schema:
You would have to invoke it by: (with builders enabled)
Rather than [what I'm suggesting]
The text was updated successfully, but these errors were encountered: