We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the following Go structure:
type CustomTypes []CustomType type test struct { Field1 CustomTypes `json:"field1"` }
This generates the following JSON schema:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://stash.sigma.sbrf.ru/scpl/core.agentserver/pkg/app/test", "$ref": "#/$defs/test", "$defs": { "CustomType": { "properties": {}, "additionalProperties": false, "type": "object" }, "CustomTypes": { "items": { "$ref": "#/$defs/CustomType" }, "type": "array" }, "test": { "properties": { "field1": { "$ref": "#/$defs/CustomTypes" } }, "additionalProperties": false, "type": "object", "required": [ "field1" ] } } }
I need to add a maxItems constraint to the CustomTypes array, for example:
"CustomTypes": { "items": { "$ref": "#/$defs/CustomType" }, "type": "array", "maxItems": 10 }
How can I achieve this? I can't add a tag to the type definition in Go.
The text was updated successfully, but these errors were encountered:
@LazarenkoA - i believe this is working - try to add this tags to your struct:
type CustomTypes []CustomType type test struct { Field1 CustomTypes `json:"field1" jsonschema:"maxItems=10"` }
it also supports minItems in the same way
minItems
Sorry, something went wrong.
@Rosswell so it adds here "field1": { "$ref": "#/$defs/CustomTypes", "maxItems": 10 }
but it needs to be in the type
No branches or pull requests
I have the following Go structure:
This generates the following JSON schema:
I need to add a maxItems constraint to the CustomTypes array, for example:
How can I achieve this? I can't add a tag to the type definition in Go.
The text was updated successfully, but these errors were encountered: