-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels