FasterXML / FasterXML/jackson-module-jsonSchema

Generate json schema which should rejects all additional content

Đang mở
#129 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
387
Fork
136
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.