stoplightio / http-spec

Utilities to normalize OpenAPI v2 and v3 objects for the Stoplight ecosystem.

Home Page:https://stoplight.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postman response examples unique keys

mtraynham opened this issue · comments

User story.

As a user, I would prefer that responses for Postman Collections have a different key other than default which make them unique. https://github.com/stoplightio/http-spec/blob/master/src/postman/transformers/params.ts#L76-L99

Is your feature request related to a problem?

I was trying out prism and noticed you could specify Prefer example=... as a header which provides a different response for the caller. This however doesn't work with Postman collections that have multiple resources with the same method/path, because all examples for a response have the key default.

Screen Shot 2021-03-01 at 7 26 43 PM

Describe the solution you'd like

Passing the response.name as a 3rd argument to transformRawBody would likely be sufficient to supply a unique name other than default, https://github.com/stoplightio/http-spec/blob/master/src/postman/transformers/response.ts#L15.

That or update the key field to be a hash of the content. Although, this would make it harder to expose in prism.

Additional context

I don't mind adding a PR, but I'd prefer to understand the reasoning about it being statically set to default and if using something like response.name is correct.