openapi-to-postman icon indicating copy to clipboard operation
openapi-to-postman copied to clipboard

Question: is there a way to seed the example data

Open carlosas opened this issue 1 year ago • 2 comments

I want to automate the update of our Postman collection from our OAS file during the pipeline. However, every time that I run the script, the example data (id, texts, etc) are recreated, and this would pollute all the following PRs.

Is there a way to avoid the example data to be recreated? Maybe through a seed?

carlosas avatar Aug 30 '23 09:08 carlosas

As a workaround, you can explicitly specify every example value in the OpenAPI spec. The OpenApi2Postman process fills in missing or invalid values with random values, but respects ones you've specified. It can be a lot of work for a large API.

It would be nice if the auto-generation was configurable. Even if it was only to be able to specifying the random seed. Making it deterministic would prevent issues with things like PRs. At the moment, if you miss a single string field example, it will spew fragments of latin.

adamhill-payroc avatar Jun 12 '24 08:06 adamhill-payroc

Best to is to define example values in your openAPI spec, these will be used in the conversion and result typically also in beter documentation.

There is also the option to configure the resolution to use the "example" (replaced with the actual example values or generated lorum ipsum values) or the schema (like string, number, ...) This can be configured via the https://github.com/postmanlabs/openapi-to-postman/blob/develop/OPTIONS.md See --options for more info https://github.com/postmanlabs/openapi-to-postman/tree/develop?tab=readme-ov-file#-command-line-interface

thim81 avatar Jul 10 '24 18:07 thim81