Skip to content

Example for link with parameter serialization needed #2539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AP-G opened this issue Apr 14, 2021 · 2 comments
Closed

Example for link with parameter serialization needed #2539

AP-G opened this issue Apr 14, 2021 · 2 comments
Labels

Comments

@AP-G
Copy link

AP-G commented Apr 14, 2021

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?

@hkosova
Copy link
Contributor

hkosova commented Apr 15, 2021

Possible duplicate of #1327?

@AP-G
Copy link
Author

AP-G commented Apr 15, 2021

Hi hkosova.

Thanks for the link. I did not find it. Let's move it to #1327 then and take my example as an additional case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants