title: Ajv: validate json with dynamic keys
body: <p>I use ajv to validate JSON data model before inserting/updating my database.</p>
  
  <p>Today I want to use this structure:</p>
  
  <pre><code>const dataStructure = {
      xxx1234: { mobile: "ios" },
      yyy89B: { mobile: "android" }
  };
  </code></pre>
  
  <p>My keys are dynamic because they are ids.
  Do you know how to validate it with <a href="https://www.npmjs.com/package/ajv" rel="nofollow noreferrer">ajv</a> ?</p>
  
  <p>PS: as an alternative solution, i can of course use this structure:</p>
  
  <pre><code>const dataStructure = {
      mobiles: [{
          id: xxx1234,
          mobile: "ios"
      }, {
          id: yyy89B,
          mobile: "android"
      }]
  };
  </code></pre>
  
  <p>Then I would have to loop on the array to find the ids I want.
  All my queries will become more complex, it bothers me.</p>
  
  <p>Thank you for your help !</p>