restapiswaggerswagger-2.0apprequests

How to analyze requests (with queries) on swagger and send different response body?


Is that possible to analyze the request (based on queries) on swagger hub api 3.0?

For example, I need to reproduce the next thing.

For request getUser?id=1 swager swagger has to send response to client

{
  "user_id": "1"
  "user_name": "Alex",
}

For request getUser?id=2 swager swagger has to send response to client

{
  "user_id": "2"
  "user_name": "Bob",
}

If that possible, could you help me with this please?


Solution

  • I guess your question is about SwaggerHub mock server. According to the documentation, this is not supported:

    Note that the mock does not support business logic, that is, it cannot send specific responses based on the input.