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;








2















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"

]










share|improve this question






























    2















    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"

    ]










    share|improve this question


























      2












      2








      2








      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"

      ]










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 13:23









      SavcoSavco

      132 bronze badges




      132 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1
















          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..."






          share|improve this answer

























          • 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










          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
          );



          );














          draft saved

          draft discarded
















          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









          1
















          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..."






          share|improve this answer

























          • 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















          1
















          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..."






          share|improve this answer

























          • 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













          1














          1










          1









          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..."






          share|improve this answer













          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..."







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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 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

















          • 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
















          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








          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.




















          draft saved

          draft discarded















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해