mbknor / mbknor-jackson-jsonSchema

Generate JSON Schema with Polymorphism using Jackson annotations
MIT License
235 stars 79 forks source link

Feature request: leverage defaultValue of @JsonProperty in place of @JsonSchemaDefault #117

Closed itzg closed 4 years ago

itzg commented 4 years ago

Currently I find that I have to declare a field's default three ways, but it sure would be nice to get that down to two since the defaultValue of @JsonProperty is always going to be exactly the same string as value of @JsonSchemaDefault, such as:

  @JsonSchemaDefault("true")
  @JsonProperty(defaultValue = "true")
  boolean totalcpu = true;

I would like to be able to use just:

  @JsonProperty(defaultValue = "true")
  boolean totalcpu = true;

with a resulting schema:

        "totalcpu": {
          "type": "boolean",
          "default": true
        },
mbknor commented 4 years ago

Included in version 1.0.38 released just now. It is on its way to maven central