FasterXML / FasterXML/jackson-module-jsonSchema
Generate json schema which should rejects all additional content
- Dominant language
- Java
- Stars
- 387
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
Provide JSON schema generation where "additionalProperties" : false will be applied for all classes which I have.
Suppose I have following classes:
```java
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.
```java
ObjectMapper mapper = new ObjectMapper();
JsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);
ObjectSchema schema = schemaGen.generateSchema(A.class).asObjectSchema();
schema.rejectAdditionalProperties();
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.