stoplightio / http-spec

Utilities to normalize OpenAPI v2 and v3 objects for the Stoplight ecosystem.

Home Page:https://stoplight.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.