Use quicktype to infer JSON Schemas in Postman Collections
karol-maciaszek opened this issue · comments
We need to replace json-schema-generator
with quicktype
. The latter brings a feature of inferring schema from couple of examples. This enables us to produce schemas with mixed, optional and required properties based on differences in examples.
Unfortunately, there is no way to configure quicktype
so it does not include additionalProperties: false
in resulting schemas. Because of that, there is a need for traversing resulting schema in order to remove those properties.
Gotcha: The traversing code must be smart enough to differentiate schema's additionalProperties
from examples or object fields.
The issue is related to stoplightio/prism#1246.
- replace
json-schema-generator
https://github.com/stoplightio/http-spec/blob/master/src/postman/transformers/params.ts#L11 withquicktype
https://www.npmjs.com/package/quicktype - traverse result of schema inference and remove
additionalProperties: false