Add support for Swagger/OpenAPI Extensions
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
There are no decorators for the Open Api Extensions
Expected behavior
This is an example of this decorator in Java Swagger module
@ApiOperation(value = "/ranking/calcio",
httpMethod = "GET",
extensions = @Extension(name = "x-amazon-apigateway-integration", properties = {
@ExtensionProperty(name = "uri", value = "http://HTTP_ENDPOINT/sportsdata/api/rest/ranking/calcio"),
@ExtensionProperty(name = "connectionType", value = "VPC_LINK"),
@ExtensionProperty(name = "connectionId", value = "VPC_LINK_ID"),
@ExtensionProperty(name = "httpMethod", value = "GET"),
@ExtensionProperty(name = "type", value = "http_proxy")
}))
That produces this output in the swagger.json file:
"/ranking/calcio" : {
"get" : {
"tags" : [ "Ranking API" ],
"summary" : "/ranking/calcio",
"description" : "",
"operationId" : "footballRankingRest",
"parameters" : [ /* ... */],
"responses" : {
"200" : {
"description" : "The football ranking",
"schema" : {
"$ref" : "#/definitions/ResponseBean"
}
}
},
"x-amazon-apigateway-integration" : {
"connectionId" : "VPC_LINK_ID",
"httpMethod" : "GET",
"type" : "http_proxy",
"uri" : "http://HTTP_ENDPOINT/sportsdata/api/rest/ranking/calcio",
"connectionType" : "VPC_LINK"
}
}
}
]
What is the motivation / use case for changing the behavior?
At this time this is blocking because we need this extension in order to use the swagger.json to generate Amazon API Gateway definition files
I did not find any doc on how to create/extend existing decorators, if you point me to the right direction i can try to implement it
Thank you for your amazing work
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:13 (7 by maintainers)
Top Results From Across the Web
OpenAPI Extensions - Swagger
Many API-related products that support OpenAPI make use of extensions to document their own attributes, such as Amazon API Gateway, ReDoc, APIMatic and ......
Read more >Extending the OpenAPI specification - API Handyman
While the Swagger Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
Read more >OpenAPI extensions and Swashbuckle - Coding Militia
Let's take a quick look at OpenAPI extensions (which I discovered were a thing last week ) and how to add them to...
Read more >SwaggerHub Vendor Extensions - SmartBear Support
SwaggerHub supports the following vendor extensions for OpenAPI. Interactive documentation. x-example. Applies to: OpenAPI 2.0. Used to specify example values ...
Read more >OpenAPI Extensions - ReadMe Documentation
Extensions are properties added to an OpenAPI spec that customize your API Reference user experience. All of these properties are optional.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@CesarBMartinez I’ll take a look into it and see if I can raise a PR.
Some solution can be done locally in the application without changes in nest/swagger
My goal was to add custom swagger parameters to request body (decorator ApiModelProperty)
{showExtensions: true}
in main.ts (necessary for UI, because even if you have custom parameters on back and in json in UI, it will be not renderred without this property):SwaggerModule.setup('api', app, document, {swaggerOptions: {showExtensions: true}});