http-spec
http-spec copied to clipboard
Postman response examples unique keys
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
.

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.