swagger-api / swagger-api/swagger-ui
Are the "Runtime Expressions" feature implemented?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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


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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report in Swagger UI with the supplied OpenAPI 3.0 Links definition and the official Runtime Expressions tutorial. Inspect how response links are displayed and whether values are evaluated after the two requests; done means the behavior is either implemented for this example or the unsupported limitation is documented clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100