FasterXML / FasterXML/jackson-module-jsonSchema

Generate json schema which should rejects all additional content

Ouverte
#129 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
387
Forks
136
Métriques de merge des PR
Aucune PR mergée en 30 j

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);
```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.