-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
using @Examples()
on a model
#2633
Labels
Comments
Solutionclass QueryParamModel {
@Property()
path: string;
@Property()
condition: string;
@Property()
value: string;
}
@Path("/query")
class QueryModelCtrl {
@OperationPath("GET", "/")
async get(
@QueryParams()
@Examples({
example1: {
description: "description1",
value: {
path: "path1",
condition: "condition1"
}
},
example2: {
description: "description1",
value: {
path: "path2",
condition: "condition2"
}
}
})
q: QueryParamModel
) {}
} Generates: {
"paths": {
"/query": {
"get": {
"operationId": "queryModelCtrlGet",
"parameters": [
{
"in": "query",
"name": "path",
"required": false,
"examples": {
"example1": {
"description": "description1",
"value": "path1"
},
"example2": {
"description": "description1",
"value": "path2"
}
},
"schema": {
"type": "string"
}
},
{
"examples": {
"example1": {
"description": "description1",
"value": "condition1"
},
"example2": {
"description": "description1",
"value": "condition2"
}
},
"in": "query",
"name": "condition",
"required": false,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "value",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success"
}
},
"tags": [
"QueryModelCtrl"
]
}
}
},
"tags": [
{
"name": "QueryModelCtrl"
}
]
} |
Romakita
added a commit
that referenced
this issue
Mar 22, 2024
Romakita
added a commit
that referenced
this issue
Mar 22, 2024
🎉 This issue has been resolved in version 7.66.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in https://github.com/orgs/tsedio/discussions/2631
Originally posted by VictoriqueMoe March 21, 2024
hello.
I have the following decorator in my argument:
this is a Parameter.
I like this because in swagger, you can get a dropdown of all the eamples
I am now moving all the
@QueryParams
to an model object to not pollute the class. my object looks as follows:I want the examples to stay for
expires
. however the@Examples()
decorator is only aParameterDecorator
and the non-plural version@Example()
does not do the same thing, all that seems to do is fill in the input with a default value. not a dropdown like@Examples()
Is there a way so that the model can have
Examples()
and it renders in the swagger of a deropdown of examples?The text was updated successfully, but these errors were encountered: