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

41 Views Asked by At

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?

1

There are 1 best solutions below

1
Helen On BEST ANSWER

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.