Forum Discussion

Acsor's avatar
Acsor
Visitor
4 years ago

How are (path, query, ...) parameters actually bound?

If I define a certain parameter to act as a filter (e.g. among a group of users) how does the specification know that I actually want that parameter to perform that operation and not something else? As far as I've seen, there's no particular syntax that specifies a desired behavior.

 

Just to put this in context, suppose I have the following Swagger 2.0 definition

paths:
  /users/{id}:
    get:
      parameters:
        - in: path
          name: id   # Note the name is the same as in the path
          required: true
          type: integer
          minimum: 1
          description: The user ID.
      responses:
        200:
          description: OK
...
definitions:
  User:
    type: object
    properties:
      id:
        type: integer
        format: int64
        minimum: 0
      name:
        type: string
    required:
      - id
      - name

 

I have defined {id} to be a path parameter with the intention to perform a filter (against user ids) but how is the system actually capable of inferring that action, like when I generate a stub server?

No RepliesBe the first to reply