Coder Social home page Coder Social logo

Comments (13)

jsdevel avatar jsdevel commented on August 17, 2024 1

Re-opening as express-openapi should aim to be as un-opinionated as possible to follow express's purpose Fast, unopinionated, minimalist web framework for Node.js.

from open-api.

mika-fischer avatar mika-fischer commented on August 17, 2024 1

Yes, that also sounds fine, I'll see if I can implement this this week.

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

So you can define paths in apiDoc.paths, and express-openapi will inherit from it, except for handlers.

What you would consider limiting, I would consider freeing.

Consider that you never have to duplicate a path, as it's entirely inferred from fs.

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

Also, your documentation is kept up to date for users. So if you delete a handler, you don't have to worry about your docs getting out of sync. This is what bothers me about other frameworks that expect a monolithic json document or yaml doc to describe their apis.

from open-api.

MugeSo avatar MugeSo commented on August 17, 2024

OpenAPI spec has $ref for Path Object

from open-api.

DaleLJefferson avatar DaleLJefferson commented on August 17, 2024

Thanks for re-opening this, it sounds like we could pull out the current convention over configuration router part of express-openapi into a separate middleware.

BTW I've successfully used a few of the express-openapi middleware with Koa, the middleware strategy you have chosen works really nicely.

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

@dalejefferson glad to hear the middleware strategy is working out for you!

I've had a few thoughts related to closing out this ticket:

  • Add a new argument to the initialization args that specifies either a module or a directory (haven't decided which would be more friendly).
  • This argument will define the operation handlers for the provided apiDoc.
  • Operation handlers are referenced via operationId in the apiDoc.

from open-api.

mika-fischer avatar mika-fischer commented on August 17, 2024

A related issue is that the reliance on fs-routes makes it totally impossible to package an app using express-openapi using webpack or similar tools. I'd like to be able to provide express-openapi with a list mapping urls to module paths or already loaded modules.

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

@mika-fischer PRs are always welcome!

from open-api.

mika-fischer avatar mika-fischer commented on August 17, 2024

@jsdevel I might give it a go. But what would your preferred API look like?

My idea would be to make the paths option optional, and add a new option (maybe routes or urls(?)) and allow to pass an array of objects: [ { route: 'foo', module: require('foo') }, ... ] or [ { route: 'foo', path: 'foo' }, ... ], similar to what fs-routes generates.

That way most of the code could be reused...

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

@mika-fischer I think the paths option array could also contain objects, and if no strings are in the array then we can skip the fs-routes call. Thoughts?

from open-api.

jsdevel avatar jsdevel commented on August 17, 2024

@dalejefferson see the great work @mika-fischer did in #60. I feel it closes this issue. Thoughts?

from open-api.

DaleLJefferson avatar DaleLJefferson commented on August 17, 2024

Thanks @mika-fischer this looks great, I will happily close this issue

from open-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.