New issue
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
can I set uniqueItems in json schema based on property of item #3909
Labels
Comments
Instead of putting unique items in the widget put it in the schema itself.
Unique items is a json schema validation key.
…On Tue, May 7, 2024, 1:58 PM John Cutburth ***@***.***> wrote:
*Question*
Is it possible to base uniqueItems on CustomTypes in my json schema on the
property CustomType of the item?
{
"properties": {
"CustomTypes": {
"items": {
"$ref": "#/definitions/CustomTypes"
},
"type": "array",
"title": "Custom Types",
"description": "The Custom type array.",
"default": [],
"widget": {
"formlyConfig":{
"templateOptions": {
"uniqueItems": true
}
}
}
}
},
"type": "object",
"required": [
"CustomTypes"
],
"title": "This is a Title",
"default_values": [
{
"CustomTypes": []
}
],
"definitions": {
"CustomTypes": {
"properties": {
"CustomType": {
"allOf": [
{
"$ref": "#/definitions/CustomType"
}
],
"title": "Custom Type",
"description": "The Custom type."
},
"TypeNames": {
"items": {
"type": "string"
},
"type": "array",
"title": "Custom Type Names",
"description": "The Custom name starts with.",
"default": []
}
},
"type": "object",
"required": [
"CustomType",
"TypeNames"
],
"title": "Custom Types"
},
"CustomType": {
"type": "string",
"enum": [
"enum_1",
"enum_2",
"enum_3",
"enum_4",
"enum_5"
],
"title": "CustomType"
}
}
}
—
Reply to this email directly, view it on GitHub
<#3909>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADB4XNNMTFGQK25TRQXOXALZBEP4HAVCNFSM6AAAAABHLR7NG6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DIMBRHE3TQOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
so like this "CustomTypes": {
"items": {
"$ref": "#/definitions/CustomTypes"
},
"type": "array",
"title": "Custom Types",
"description": "The Custom type array.",
"default": [],
"uniqueItems": true
} So when dealing with an object vs a enum how do I tell it what property of that object to base uniqueness off of? I don't want more then one object with the same enum. |
When dealing with objects unique items baseline from json schema is defined
to check if any one of the things in the entries is different.
If you want this to change you could write an extension or just a plain
validator that overwrites how unique items works by passing a unique items
key prop or something.
…On Tue, May 7, 2024, 4:20 PM John Cutburth ***@***.***> wrote:
Instead of putting unique items in the widget put it in the schema itself.
Unique items is a json schema validation key.
so like this
"CustomTypes": {
"items": {
"$ref": "#/definitions/CustomTypes"
},
"type": "array",
"title": "Custom Types",
"description": "The Custom type array.",
"default": [],
"uniqueItems": true
}
So when dealing with an object vs a enum how do I tell it what property of
that object to base uniqueness off of? I don't want more then one object
with the same enum.
—
Reply to this email directly, view it on GitHub
<#3909 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADB4XNNXBT4UDSCEDWFRKILZBFAQHAVCNFSM6AAAAABHLR7NG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGMZDQNZVGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question
Is it possible to base uniqueItems on CustomTypes property in my json schema on the property CustomType in the CustomTypes schema in definitions?
The text was updated successfully, but these errors were encountered: