-
Notifications
You must be signed in to change notification settings - Fork 504
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
fix: Store all Response examples by name #1571
Conversation
Allow use multiple times the @response decorator with the same status and different examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there MiguelSavignano 👋
Thank you and congrats 🎉 for opening your first PR on this project.✨
We will review the following PR soon! 👀
LGTM, thanks! |
* Store all Response examples by name Allow use multiple times the @response decorator with the same status and different examples. * type Record * reanme responseExamplesByName * test multiple response same status code
hey @WoH then in the spec it overwrites MIME types: So, there is only available single type {
"400": {
"description": "Bad Request",
"content": {
"text/plain": {
"schema": {
"type": "string"
},
"examples": {
"Example 1": {
"value": {
"message": "Validation Error",
"details": {
"body.sessionId": {
"message": "'sessionId' is required"
}
}
}
},
"Example 2": {
"value": "Unsupported data provided"
},
"Example 3": {
"value": "Session already exists"
}
}
}
}
}
} Update: @Response<ValidationError>(400, ReasonPhrases.BAD_REQUEST, ValidationErrorSample)
@Response<string>(400, ReasonPhrases.BAD_REQUEST, 'Unsupported data provided')
@Response<string>(400, ReasonPhrases.BAD_REQUEST, 'Session already exists') Produced spec has also broken schema -- just {
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
// it's not just a string
"type": "string"
},
"examples": {
"Example 1": {
"value": {
"message": "Validation Error",
"details": {
"fieldName": {
"message": "Description of the specific error"
}
}
}
},
"Example 2": {
"value": "Unsupported data provided"
},
"Example 3": {
"value": "Session already exists"
}
}
}
}
}
} And then if I remove generic type and add Ideally I want to get MIME type from Possible problem:
|
Allow use multiple times the
@Response
decorator with the same status and different examples.expected result:
Controller with
@Response
status 400 and 2 response examples.Swagger.json:
All Submissions:
Closing issues
Closes #1570
If this is a new feature submission:
Potential Problems With The Approach
Test plan