I suggest you ...

Allow multiple response code definitions for the same response code and content-type

In my use case, for a given request, there are a variety of possible responses of the same response code. For example...

# GET /api/v1/resource

+ Response 200

+ Headers

Content-Type:application/json

+ Body

{ <unique combination of attributes> }

+ Response 200

+ Headers

Content-Type:application/json

+ Body

{ <unique combination of attributes> }

Currently, this gives an error "Response payload `200` already defined for `GET` method".

This seems like it would not be an uncommon requirement. Is there already a method to do this that I am missing?

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    MatthewMatthew shared this idea  ·   ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • ApiaryAdminApiary (Admin, apiary.io) commented  · 

        You can write it as "request-response" pairs, so you will be able to select the response if you want to. Or simply remove the `+ Request` parts, and it will show just a warning, not an error.
        Without the unique Requests, the mock-server won't be able to select the appropriate response - thus removing a part of functionality.

        ```
        ## Tool [/tool/{id}]

        ### Check the tools [GET]

        + Request
        + Header
        X-Custom-Variant: 1

        + Response 200 (text/plain)
        Body-response for Variant 1

        + Request
        + Header
        X-Custom-Variant: 2

        + Response 200 (text/plain)
        Body-response for Variant 2

        + Request
        + Header
        X-Custom-Variant: 3

        + Response 200 (text/plain)
        Body-response for Variant 3
        ```

      Feedback and Knowledge Base