mbknor / mbknor-jackson-jsonSchema

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

Pattern (regex) is not supported? #126

Open xiacheng opened 4 years ago

xiacheng commented 4 years ago

{ "type": "string", "pattern": "^(\([0-9]{3}\))?[0-9]{3}-[0-9]{4}$" } Trying to add pattern field, and thought it could be good to leverage the jackson annotation @JsonFormat

big-andy-coates commented 3 years ago

Maybe not the cleanest, but you can achieve this via:

@JsonSchemaFormat("string")
@JsonSchemaInject(json = "{\"pattern\":\"<your-pattern>\"")