Provide an OpenAPI vendor extension to enable auto-wiring declared API endpoints to express route handler functions
See original GitHub issueI’m writing an issue through Google Translator. I hope the contents are well communicated.
Sir,
Your project is amazing.
However, it would be nice to have additional features.
I’d like to propose to consider introducing additional features, so I’m writing an issue.
If you don’t mind me asking please to consider the following features.
For example, set operationId
, eov-controller
(name is just an example) in api.yaml
as shown below.
I think it would be cool if the routing configuration is automated.
I hope to hear from you soon. Thank you. I wish you good luck.
- api.yaml
openapi: '3.0.0'
info:
version: 1.0.0
title: Swagger Petstore
description: A sample API
termsOfService: http://swagger.io/terms/
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: /v1
paths:
/pets:
get:
description: |
Returns all pets
operationId: 'pets#findPets' # will be automatically fetched
eov-controller: 'pets' # load pets.js
- pets.js
module.exports = {
'pets#findById': (req, res, next) => {
res.json(pets.findAll(req.query));
}
};
- don’t need to write code like this
// It will be fetched automatically.
app.get('/v1/pets', (req, res, next) => {
res.json(pets.findAll(req.query));
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (9 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 >How to Build Better APIs in Express with OpenAPI
In this article, I will share how to build robust REST APIs in Express. First, I will present some of the challenges of...
Read more >Part 2. Express Routing with Open API 3.0 and Swagger UI ...
The config defines a root path /api/v1 with a single entry point GET /hello with an optional parameter name in the request query...
Read more >express-openapi - npm
An unopinionated OpenAPI framework for express. ... Start using express-openapi in your project by running `npm i express-openapi`.
Read more >Securing a Rest API with Spring Security - OctoPerf
Quick and easy way to secure a Rest API with Spring Security. Spring Boot 2 and Spring Security 5 tutorial with real-world code...
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 Free
Top 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
Thanks @foway0. This is a nice idea. It’s certainly worth considering.
We do welcome PRs.
If you would like to attempt an initial pass at implementing your proposed feature, I will certainly consider integrating it.
Let me know if you would like to give it a try.
If so, there is also a gitter channel that we can use to chat in real time if desired. https://gitter.im/cdimascio-oss/community
@foway0 I’ve created a PR that contains your feature work https://github.com/cdimascio/express-openapi-validator/pull/228