Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: is there a way to seed the example data #757

Open
carlosas opened this issue Aug 30, 2023 · 2 comments
Open

Question: is there a way to seed the example data #757

carlosas opened this issue Aug 30, 2023 · 2 comments

Comments

@carlosas
Copy link

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?

@adamhill-payroc
Copy link

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.

@thim81
Copy link
Contributor

thim81 commented Jul 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants