Skip to content

Example for link with parameter serialization needed #2539

Closed
@AP-G

Description

@AP-G

I've already looked here: https://swagger.io/docs/specification/serialization/, https://swagger.io/docs/specification/serialization/
and at this discussion: OAI/learn.openapis.org#100

I hope you can help me with this:

A get operation response returns an object containing an array of IDs of another resource. I want to define a link to read the corresponding resources by ID. So if I define the link to the array, I would need to define the operation with parameter serialization. But this I do not want to be supported. I just want to support an operation that is only capable to take one ID and return one response object.

Is it possible to specify in the link, that each of the array results should be taken one by one and be passed sequentially (not serialized) to the get operation?

Here is the example

openapi: 3.0.2
info:
  title: Link question
  version: 0.1.0
paths:
  /users/{id}:
    get:
      operationId: getUserById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
  /myapp:
    get:
      operationId: getAppInformation
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  appName:
                    type: string
                  users:
                    type: array
                    items:
                      type: string
              example:
                {
                  "appName": "My App",
                  "users": [
                    "u1",
                    "u2",
                    "u3"
                  ]
                }
          links:
            getUser:
              operationId: getUserById
              parameters:
                id: $response.body#/users

If I understand right, the link would allow a call like /users/u1,u2,u3. But instead I want to specify that this should be separated into three single calls /users/u1, /users/u2, and /users/u3. To define the link parameter as $response.body#/users[0] is no solution for this, as I do not only want to follow the first element of the result.

Any idea how to specify this else than in the description?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions