title: json-schema v4 how-to implements enums depending on enums?
body: <p>Using <a href="https://github.com/jdorn/json-editor" rel="nofollow noreferrer">json-editor</a>, and looking at this <a href="https://stackoverflow.com/questions/18375506/how-to-use-dependencies-in-json-schema-draft-04/18384131#18384131">answer</a>, I am trying to do the following, using json-schema v4:</p>
  
  <p>Use a root property to select one of two categories <code>['clothing', 'accessory']</code>, which will determine enum-values for a <code>material</code> property. </p>
  
  <p>The case I am trying to solve has multiple enum-properties depending on the <code>category</code>-value.</p>
  
  <p>Pseudocode example:</p>
  
  <pre><code>{
      "type": "object",
      "Title": "Products",
      "definitions": {
          "clothing": {
              "materials": ["yak", "merino"]
          },
          "accessories": {
              "materials": ["brass", "silver"]
          }
      },
      "properties": {
          "productType": {
              "type": "string",
              "enum": [
                  "clothing",
                  "accessories"
              ]
          },
          "materials": {
              "type": "array",
              "title": "Materials",
              "items": {
                  "type": "string",
                  "title": "Material",
                  "enum": [
                      {"$ref" : "#definitions/{{productType}}/materials"}
                  ]
              }
          }
      } 
  }
  </code></pre>
  
  <p>Any suggestions on how to structure this?</p>