-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
Provide JSON schema generation where "additionalProperties" : false will be applied for all classes which I have.
Suppose I have following classes:
class A{
private String s;
private B b;
public String getS() {
return s;
}
public B getB() {
return b;
}
}
class B{
private BigDecimal bd;
public BigDecimal getBd() {
return bd;
}
}
Generating schema as following like below code the schema property "additionalProperties" : false was applying only for the class A.
ObjectMapper mapper = new ObjectMapper();
JsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);
ObjectSchema schema = schemaGen.generateSchema(A.class).asObjectSchema();
schema.rejectAdditionalProperties();
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);
Metadata
Metadata
Assignees
Labels
No labels