Closed sdelamo closed 4 months ago
I think for:
package example.micronaut; import io.micronaut.jsonschema.JsonSchema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.Size; import java.util.Set; /** * * @param tags Tags for the product */ @JsonSchema(description = "A product from Acme's catalog") public record Product(@Size(min = 1) Set<String> tags) { }
It generates:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "http://localhost:8080/schemas/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": [ "object" ], "properties": { "tags": { "description": "Tags for the product", "type": [ "array" ], "items": { "type": [ "string" ] }, "minItems": 1 } } }
tags should add the attribute "uniqueItems": true:
"uniqueItems": true
"tags": { "description": "Tags for the product", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }
I think for:
It generates:
tags should add the attribute
"uniqueItems": true
: