json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

Add support for `unevaluatedProperties` keyword

Open nahcikuy opened this issue 3 years ago • 3 comments

Draft 2019-09 introduces the new keyword unevaluatedProperties, which seems not supported in this project yet.

A schema with "unevaluatedProperties": false will lead to the generated type definition containing an extra [k: string]: unknown; field, which is expected not to be seen.

Reproduction

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "title": "Foo",
  "properties": {
    "bar": {
      "type": "string"
    }
  },
  "unevaluatedProperties": false
}

yields

export interface Foo {
  bar?: string;
  [k: string]: unknown;
}

which is expected to be

export interface Foo {
  bar?: string;
}

instead.

nahcikuy avatar Feb 28 '22 09:02 nahcikuy

@bcherny Boris, what do you think about this?

OnkelTem avatar Apr 07 '22 09:04 OnkelTem

Yes that would be super cool, thanks 🎉

le-u-f avatar Apr 29 '22 15:04 le-u-f

Is there anyone working on this? I'd love to have a try.

decadef20 avatar Jun 11 '22 17:06 decadef20