postmanlabs / openapi-to-postman

Plugin for converting OpenAPI 3.0 specs to the Postman Collection (v2) format
Apache License 2.0
930 stars 200 forks source link

Reduced collection size by keeping maximum generated elements for array as 1 for larger schemas. #737

Closed VShingala closed 1 year ago

VShingala commented 1 year ago

Overview

This PR adds support for restricting the elements generated in collection from default 2 to 1 element based upon the schema size. Current threshold for this is for schemas larger than 50 KB.

Solution

We've removed the part where minItems and maxItems were had coded into schema while resolution and added support for this in json-schema-faker library. In jsf library we've added similar logic by usage of options that can be configured while using this library. And while faking the schema, we use these options depending upon the schema size.