tapir icon indicating copy to clipboard operation
tapir copied to clipboard

[FEATURE] Json Schema - Include uniqueItems when array is created from Set

Open michalbogacz opened this issue 2 years ago • 0 comments

Tapir version: 1.9.6

Scala version: Any

Describe the bug

Schema description for Arrays does not include uniqueItems even if it's created from Set[]. For reference https://json-schema.org/understanding-json-schema/reference/array#uniqueItems

This feature is useful to know API is returning array of unique elements and there is no need to deduplicate.

How to reproduce?

In current version create schema with Set type field (and e.g. enum). Result:

"SetWithEnums" : {
    "type" : "array",
    "items" : {
        "$ref" : "#/$defs/MyEnum"
    }
}

Additional information

This feature is supported in https://github.com/andyglow/scala-jsonschema

michalbogacz avatar Jan 05 '24 12:01 michalbogacz