question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide an OpenAPI vendor extension to enable auto-wiring declared API endpoints to express route handler functions

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
cdimasciocommented, Dec 12, 2019

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

1reaction
cdimasciocommented, Feb 9, 2020

@foway0 I’ve created a PR that contains your feature work https://github.com/cdimascio/express-openapi-validator/pull/228

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found