glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.12k stars 1.06k forks source link

fixed #2411: `true` is a JSON schema equivalent to `any` #2412

Closed feefladder closed 7 months ago

feefladder commented 11 months ago

See #2411. Tested with the example:

  1. put into test.json:
    {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "properties": {
          "enum": {
              "type": "array",
              "items": true
          }
     }
    }
  2. script/quicktype --src test.json --src-lang schema --just-types -o test.ts
  3. output:

    export interface TestObject {
        enum?: any[];
    }

I didn't look into how to test everything, but would be happy to do so if given a pointer

dvdsgl commented 7 months ago

Thank you!