Open sashafklein opened 2 years ago
Add
additionalProperties: false
Person: {
type: "object",
properties: {
first_name: {
type: "string",
example: "Pam",
},
last_name: {
type: "string",
example: "Halpert",
},
},
additionalProperties: false,
required: [],
title: "Person",
},
It would be nice if there was a flag to control this... I know it's technically incorrect, but a lot of 3rd party schema omit specifying additionalProperties: false
. If you're trying to use this library to improve developer productivity and reduce bugs when interactive with one of these api, then having [key: string]: any;
defeats the usefulness of this library.
I'm using typeconv to convert some OpenAPI schemas into TypeScript interfaces. Generally working great, but I noticed one thing.
When I start with the below OpenAPI spec:
It produces the following type:
Almost perfect, except for that last line:
It's appending a wildcard accessor to my type, for some reason, essentially asserting that on
Person
, any string can access any value, which makes the type not particularly helpful.Any ideas what this is happening? I could get rid of this line through string manipulation, but I wonder why it's happening, and if there's some option I'm missing.