-
Notifications
You must be signed in to change notification settings - Fork 863
Closed
Description
We use a Postman Team account to publish Collections and Documentation and drive everything off of the OpenAPI spec during CI in an automated fashion. An ideal workflow would be,
- Update OpenAPI spec
- Upload to Postman via Update Schema, triggering the Collection created from that schema and the Documentation created from that Collection to automatically update
- Customers of our API can fork the Collection so they can optionally pull in updates as they're made
Here's another explanation of what we're after.
Unfortunately, reality is quite different. Here is our current workflow to get this working,
- Update OpenAPI spec
- The spec must explicitly include the
AuthorizationandContent-Typeheaders in each endpoint in order to show correctly in Postman Documentation's code samples (link to issue) as described in this issue comment. We're also impacted by Auth issues described here, here, and here.
- The spec must explicitly include the
- Resolve the schema to a single file using openapi-generator-cli's
openapi-yamlgenerator because the tool in the next step returnsschema type not providederrors for multi-file specs referenced via$ref - Use a forked version of Postman's openapi-to-postmanv2 tool to convert the spec to a Postman collection. The forked version contains the following fixes
- This PR ensures IDs for the same endpoints remain unchanged. This is crucial because otherwise when you update the collection, it removes all the old endpoints and creates all new ones. This, in turn, changes the URLs for each endpoint if you're using Postman's Documentation. Here's another issue from 2017 describing the problem.
- This PR so you can pass configuration via the CLI
- Increased
stackLimitfrom 10 to 20 since it's not configurable and sets some request bodies to<Error: Too many levels of nesting to fake this schema>otherwise
- Because of 1. i. above, we next have to run a
sedcommand to remove theContent-Typeheader automatically added by theopenapi-to-postmantool so only the manually added one remains, otherwise it shows up twice in the Collection and Documentation. I'm not sure why this automatically included header doesn't show up in code samples but the manually added one does. - Convert the schema to JSON because Postman's Update Schema API requires it as a string and it's not trivial to escape YAML as a string inside a JSON value
- Upload to Postman via Update Schema, this does nothing to Collections created from the schema, so...
- Could be solved with this issue
- Upload openapi-to-postman output via Update Collection, triggering the Documentation created from that Collection to automatically update.
- Our customers must either continue using their old collections or import the new one and lose all their changes since forking/version control is only available within teams.
Related issues
- Extend API support fo Postman Documentor
- Postman integration into CI/CD pipline for creating and updating postman collections
Is there a simpler, already existing workflow to accomplish what we're after? This seems like a relatively normal use-case: update one file (the OpenAPI spec) and have all downstream artifacts ("Golden" Collection, Documentation, Forked Collections, SDKs) automatically pull in those changes.
obieo, vibin, brentav, kbpope, danschultz and 13 more5thdimensional