postmanlabs / openapi-to-postman

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

Added support for response code based multi example matching. #797

Closed VShingala closed 3 months ago

VShingala commented 4 months ago

Overview

Certain tooling like NSwag generates examples for separate response code differently. i.e. Request body contains examples field with multiple response code values as keys and actual example as value. Meanwhile, relative responses will simply define example as actual example value.

Here's example definition generated by NSwag.

Since Our existing support (https://github.com/postmanlabs/openapi-to-postman/pull/792) only supports example matching based on examples key-matching, such definitions created collections with multiple examples that users might not find useful.

This PR adds support for collection generation from such definition to have response code based examples matching. More details is mentioned in code. And related tests has also been added.