Skip to content
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

Are the "Runtime Expressions" feature implemented? #5177

Open
kacbuk001 opened this issue Feb 13, 2019 · 2 comments
Open

Are the "Runtime Expressions" feature implemented? #5177

kacbuk001 opened this issue Feb 13, 2019 · 2 comments

Comments

@kacbuk001
Copy link

Description

I have been following line by line official tutorial about OAS 3.0 Links (https://swagger.io/docs/specification/links/), but it seems to me that "runtime expressions" feature is not implemented yet. Runtime expressions are not updating values or creating links dynamically when I made request to server with implemented logic.

OpenAPI definition

openapi: 3.0.0
info:
  version: 0.0.1
  title: Links example
servers:
- url: http://localhost:8089
  description: "Server"
paths:
  /users:
    post:
      summary: Creates a user and returns the user ID
      operationId: createUser
      requestBody:
        required: true
        description: A JSON object that contains the user name and age.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    format: int64
                    description: ID of the created user.
          # -----------------------------------------------------
          # Links
          # -----------------------------------------------------
          links:
            GetUserByUserId:   # <---- arbitrary name for the link
              operationId: getUser
              # or
              # operationRef: '#/paths/~1users~1{userId}/get'
              parameters:
                userId: '$response.body#/id'
              description: >
                The `id` value returned in the response can be used as
                the `userId` parameter in `GET /users/{userId}`.
          # -----------------------------------------------------
  /users/{userId}:
    get:
      summary: Gets a user by ID
      operationId: getUser
      parameters:
        - in: path
          name: userId
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: A User object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
        name:
          type: string

Screenshots

image
image

Summary

As you can see, I have performed 2 different request to server, but I cannot see any proper links generated. They exists only in example response section but they are static.
Is there any thing wrong with my code or runtime expressions just do not work?

@stormwind85
Copy link

+1

I don't understand what is it supposed to be happen.
They are no generated links !
What is this feature supposed to do with Swagger-Ui ?

@exalight87
Copy link

Any update on it?
I'm currently trying to make it work but I have still {$request.query.endpointUrl} in the http page instead of the url put in the query.
How can we use this nice feature?

Thx for the help.

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

No branches or pull requests

3 participants