AnyOf vs type arrayWhat JSON would be valid for keyword 'anyOf'anyOf: $ref in swagger JSON schema definitionwhat is the difference between properties and patternProperties in json schema?What is the difference between “anyof” and “oneof” in z schema?Why JSONSchema allows different types constraints simultaneouslyJSON schema: schemas in typesWhat if `items` and `type` were defined as arrays, without anyOf propertyJson schema validation errorHow do JSON schema's anyOf type translate to typescript?Content of an property dependent on another property value
What if I don't know whether my program will be linked to a GPL library or not?
Can I separate garlic into cloves for storage?
Story/1980s sci fi anthology novel where a man is sucked into another world through a gold painting
How is underwater propagation of sound possible?
All numbers twice in a 7x7 Minesweeper grid
Who are the people reviewing far more papers than they're submitting for review?
Python web-scraper to download table of transistor counts from Wikipedia
Madrid to London w/ Expired 90/180 days stay as US citizen
How important is weather sealing for a winter trip?
How to generate short fixed length cryptographic hashes?
What was the earliest microcomputer Logo language implementation?
Microservices and Stored Procedures
Where did Otto von Bismarck say "lying awake all night, hating"?
How to convey to the people around me that I want to disengage myself from constant giving?
How do you determine which representation of a function to use for Newton's method?
Wrong Schengen Visa exit stamp on my passport, who can I complain to?
Tips for remembering the order of parameters for ln?
Talk about Grandpa's weird talk: Who are these folks?
What is this WWII four-engine plane on skis?
Does Forgotten Realms setting count as “High magic”?
Is there a theorem in Real analysis similar to Cauchy's theorem in Complex analysis?
Abilities interrupting effects on a cast card
Cube around 2 points with correct perspective
How do we know that black holes are spinning?
AnyOf vs type array
What JSON would be valid for keyword 'anyOf'anyOf: $ref in swagger JSON schema definitionwhat is the difference between properties and patternProperties in json schema?What is the difference between “anyof” and “oneof” in z schema?Why JSONSchema allows different types constraints simultaneouslyJSON schema: schemas in typesWhat if `items` and `type` were defined as arrays, without anyOf propertyJson schema validation errorHow do JSON schema's anyOf type translate to typescript?Content of an property dependent on another property value
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Are there any differences between the following two JSON schemas validations or do they validate the same data structure?
SomeProperty
"type": ["integer","string"]
SomeProperty
"anyOf": [
"type": "integer"
,
"type": "string"
]
jsonschema
add a comment
|
Are there any differences between the following two JSON schemas validations or do they validate the same data structure?
SomeProperty
"type": ["integer","string"]
SomeProperty
"anyOf": [
"type": "integer"
,
"type": "string"
]
jsonschema
add a comment
|
Are there any differences between the following two JSON schemas validations or do they validate the same data structure?
SomeProperty
"type": ["integer","string"]
SomeProperty
"anyOf": [
"type": "integer"
,
"type": "string"
]
jsonschema
Are there any differences between the following two JSON schemas validations or do they validate the same data structure?
SomeProperty
"type": ["integer","string"]
SomeProperty
"anyOf": [
"type": "integer"
,
"type": "string"
]
jsonschema
jsonschema
asked Mar 28 at 13:23
SavcoSavco
132 bronze badges
132 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
They are equivalent!
type
The value of this keyword MUST be either a string or an array. If it
is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"), or "integer"
which matches any number with a zero fractional part.
An instance validates if and only if the instance is in any of the
sets listed for this keyword.
https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
Notice the last section "...in any of..."
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could useoneOfin place ofanyOfin your example. While with this example they are they same, they do have different implications when you include other keywords.
– Relequestual
Mar 28 at 13:44
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398748%2fanyof-vs-type-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
They are equivalent!
type
The value of this keyword MUST be either a string or an array. If it
is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"), or "integer"
which matches any number with a zero fractional part.
An instance validates if and only if the instance is in any of the
sets listed for this keyword.
https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
Notice the last section "...in any of..."
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could useoneOfin place ofanyOfin your example. While with this example they are they same, they do have different implications when you include other keywords.
– Relequestual
Mar 28 at 13:44
add a comment
|
They are equivalent!
type
The value of this keyword MUST be either a string or an array. If it
is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"), or "integer"
which matches any number with a zero fractional part.
An instance validates if and only if the instance is in any of the
sets listed for this keyword.
https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
Notice the last section "...in any of..."
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could useoneOfin place ofanyOfin your example. While with this example they are they same, they do have different implications when you include other keywords.
– Relequestual
Mar 28 at 13:44
add a comment
|
They are equivalent!
type
The value of this keyword MUST be either a string or an array. If it
is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"), or "integer"
which matches any number with a zero fractional part.
An instance validates if and only if the instance is in any of the
sets listed for this keyword.
https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
Notice the last section "...in any of..."
They are equivalent!
type
The value of this keyword MUST be either a string or an array. If it
is an array, elements of the array MUST be strings and MUST be unique.
String values MUST be one of the six primitive types ("null",
"boolean", "object", "array", "number", or "string"), or "integer"
which matches any number with a zero fractional part.
An instance validates if and only if the instance is in any of the
sets listed for this keyword.
https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
Notice the last section "...in any of..."
answered Mar 28 at 13:41
RelequestualRelequestual
4,8346 gold badges34 silver badges69 bronze badges
4,8346 gold badges34 silver badges69 bronze badges
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could useoneOfin place ofanyOfin your example. While with this example they are they same, they do have different implications when you include other keywords.
– Relequestual
Mar 28 at 13:44
add a comment
|
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could useoneOfin place ofanyOfin your example. While with this example they are they same, they do have different implications when you include other keywords.
– Relequestual
Mar 28 at 13:44
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
If you have any specific questions which aren't on topic for StackOverflow, feel free to join the JSON Schema slack, found on the JSON Schema site.
– Relequestual
Mar 28 at 13:42
You could use
oneOf in place of anyOf in your example. While with this example they are they same, they do have different implications when you include other keywords.– Relequestual
Mar 28 at 13:44
You could use
oneOf in place of anyOf in your example. While with this example they are they same, they do have different implications when you include other keywords.– Relequestual
Mar 28 at 13:44
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398748%2fanyof-vs-type-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown