title: How to use JSON schema oneOf for arrays with fixed values
body: <p>I want to specify multiple values for <code>oneOf</code> and have defined the below schema that validates successfully (<a href="http://json-schema-validator.herokuapp.com/" rel="nofollow noreferrer">http://json-schema-validator.herokuapp.com/</a>). Note there is deliberately only one value under <code>oneOf</code> in this example.</p>
  
  <pre><code>{
      "id": "test-schema",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "test schema",
  
      "type": "object",
      "properties": {
  
          "alpha": {
  
              "type": "object",
              "properties": {
  
                  "beta": {
  
                      "oneOf": [
                          {
                              "type": "object",
                              "properties": {
  
                                  "ObjA": {
  
                                      "type": "object",
                                      "properties": {
  
                                          "a": {
  
                                              "type": "array",
                                              "items": {
  
                                                  "type": "number",
                                                  "default": [90, 95],
                                                  "additionalProperties": false
                                              },
                                              "additionalProperties": false
                                          },
  
                                          "b": {
  
                                              "type": "array",
                                              "items": {
  
                                                  "type": "number",
                                                  "default": [4, 8],
                                                  "additionalProperties": false
                                              },
                                              "additionalProperties": false
                                          },
  
                                          "c": {
  
                                              "type": "array",
                                              "items": {
  
                                                  "type": "number",
                                                  "default": [0.2, 0.6],
                                                  "additionalProperties": false
                                              },
                                              "additionalProperties": false
                                          }
                                      },                                    
                                      "additionalProperties": false
                                  }
                              }, 
                              "additionalProperties": false
                          }
                      ]
                  }
              },         
              "additionalProperties": false
          }
      },
      "additionalProperties": false
  }    
  </code></pre>
  
  <p>Q1: I am using <code>default</code> to specify the initial array value but really want these to be fixed and disallow any other values. How can I achieve this?</p>
  
  <p>Answered here <a href="https://stackoverflow.com/questions/45281533/how-to-specify-which-oneof-item-a-json-object-should-take">How to specify which oneOf item a JSON object should take?</a> .</p>
  
  <p>Q2: I want to specify that <code>beta</code> be assigned <code>ObjA</code> in a JSON file that validates against this schema, how do I specify this?</p>
  
  <p>Answered here <a href="https://stackoverflow.com/questions/45281533/how-to-specify-which-oneof-item-a-json-object-should-take">How to specify which oneOf item a JSON object should take?</a> .</p>