Giter VIP home page Giter VIP logo

Comments (23)

viralanomaly avatar viralanomaly commented on August 25, 2024 11

Is there any update on this? Would it be possible to document the fact that nodejs-server doesn't work with 3.0 specs somewhere more obvious? I just wasted more time than I'd like to admit because of this.

from openapi-generator.

saprenitin avatar saprenitin commented on August 25, 2024 9

Hello,
When are you guys planning to release support for NodeJS?
Thanks

from openapi-generator.

wing328 avatar wing328 commented on August 25, 2024 7

Totally agree with creating another NodeJS server generator for other frameworks and later mark "nodejs-server" as deprecated.

from openapi-generator.

wing328 avatar wing328 commented on August 25, 2024 4

Hi all,

I've filed #2566 to add a new NodeJS (Fastify) server generator as an alternative as the existing NodeJS server generator won't work due to limitations in the dependency (not supporting OpenAPI v3).

It's still work-in-progress but worth sharing here to start collecting feedbacks.

Please check it out when you've time.

Thanks,
William

from openapi-generator.

philipmarkgreen avatar philipmarkgreen commented on August 25, 2024 3

Is this still an issue given that a NodeJs server has been added? Note that I cannot still get the new nodejs server to run.

from openapi-generator.

tuxedo0801 avatar tuxedo0801 commented on August 25, 2024 2

Still no progress. Just used the JAR on command line and got the same output as @ackintosh :-(

cc @emilianobonassi @CodeNinjai @frol @cliffano (TechnicalCommittee)

from openapi-generator.

tedepstein avatar tedepstein commented on August 25, 2024 2

@wing328 , @ackintosh, @emilianobonassi , with regard to an alternative OpenAPI v3 parser and object representation: you might want to look at KaiZen OpenAPI Parser.

It's written in Java, but it also includes its own metadata description of an OAS3 object model, with mappings to the JSON/YAML representation of an OAS3 document. The classes and parsing logic are all driven from this declarative configuration file. I believe most of that code generation and runtime serialization/deserialization are handled by a related project called JSON Overlay.

It might be practical for you to port this to JavaScript/NodeJS, generating code from the same metadata format. Both KaiZen Parser and JSON Overlay were written by @andylowry , who might be able to provide some pointers if you decide to try this approach.

from openapi-generator.

emilianobonassi avatar emilianobonassi commented on August 25, 2024 1

@ackintosh , I agree with you, we should absolutely remove swagger-tools dependency from this generator. Around there's some work, e.g. https://github.com/atlassian/koa-oas3 (in TypeScript)
We can draft a new Node.js gen.

from openapi-generator.

cjuenger avatar cjuenger commented on August 25, 2024 1

Is there any work in progress regarding this issue? I defined my API (OAS 3.0) in swagger with the assumption that the code generation works as the openapi-generator documentation states.

If a generator is not supported or erroneous, it maybe would help to remove it from the list of supported generators in the documentation.
Giving hints on the start pages of swagger.io and/or openapi-generator.tech would help as well. At least a warning which states: "Warning: Check support of target code generator." or similar.

from openapi-generator.

ellipsistechnology avatar ellipsistechnology commented on August 25, 2024 1

I have forked both openapi-generator and oas3-tools and made just enough changes to get it working for my case. It is relatively untested and I make no guarantees that it will solve others' problems, but you might like to have a look at the changes and/or use it:
ellipsistechnology/openapi-generator
ellipsistechnology/oas3-tools

from openapi-generator.

wing328 avatar wing328 commented on August 25, 2024 1

Please check out the branch nodejs-express-server (alpha) and let us know if you've any feedback.

Thanks @YishTish for contributing the new generator.

from openapi-generator.

wing328 avatar wing328 commented on August 25, 2024 1

Added nodejs-express-server generator (included in v4.1.0 release).

from openapi-generator.

ackintosh avatar ackintosh commented on August 25, 2024

@emilianobonassi Thanks for the suggestion!
I searched for other Node.js libraries, but no one corresponding to OAS3 was found. 👀 (There are some works that supports OAS2, but those were not updated)

from openapi-generator.

emilianobonassi avatar emilianobonassi commented on August 25, 2024

@ackintosh, I've looked and I got the same result.
IMHO, we should write from scratch a library for oas3. I think that should be a good idea to take https://github.com/atlassian/koa-oas3 as an example.

We could also think to transpile that library to javascript using tsc from official npm package typescript.

Anyway, I think the best idea is the first one. What do you think?

from openapi-generator.

ackintosh avatar ackintosh commented on August 25, 2024

The first one looks good to me, too.

However, I can not imagine how difficult it is to write a library from scratch since I'm not so familiar with javascript. 💦
(I think "transpile the library to javascript" or "new Node.js gen with koa-oas3" will be option if the first one is too hard.)

from openapi-generator.

emilianobonassi avatar emilianobonassi commented on August 25, 2024

@ackintosh it is not so difficult, it can be a good exercise.

We could proceed with both, one of us go for transpilation and the other one for scratch.
What do you prefer?

from openapi-generator.

ackintosh avatar ackintosh commented on August 25, 2024

Unfortunately no updates. 😢

Quick idea: what about displaying notification message on generating the Node.js server like below?

$ java -jar ......... -g nodejs-server

Currently, Node.js server doesn't work as its dependency doesn't support OpenAPI Spec3.
For further details, see https://github.com/OpenAPITools/openapi-generator/issues/34

[main] INFO  o.o.codegen.AbstractGenerator - writing file /Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/server/petstore/nodejs/controllers/Pet.js
[main] INFO  o.o.codegen.AbstractGenerator - writing file /Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/server/petstore/nodejs/service/StoreService.js
[main] INFO  o.o.codegen.AbstractGenerator - writing file /Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/server/petstore/nodejs/controllers/Store.js
[main] INFO  o.o.codegen.AbstractGenerator - writing file /Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/server/petstore/nodejs/service/UserService.js

...
...
...

cc @emilianobonassi @CodeNinjai @frol @cliffano (TechnicalCommittee)

from openapi-generator.

viralanomaly avatar viralanomaly commented on August 25, 2024

from openapi-generator.

danorton avatar danorton commented on August 25, 2024

@philipmarkgreen, yes, this is still an issue as long as it is in state "Open".

I'd like to know which server(s) actually work and are as easy to deploy. I haven't had any luck on the few other types I've tried (e.g. java-inflector)

from openapi-generator.

danorton avatar danorton commented on August 25, 2024

There are a lot of red herring comments w.r.t. OpenAPI 3.0: This server doesn't work with any version of the API, not even with swagger 2.0.

from openapi-generator.

torra avatar torra commented on August 25, 2024

fwiw, i was able to get the pet store example working in nodejs by copying the initial swagger.yaml file to the generated api/openapi.yaml. i'm not sure what other consequences there might be from this but the example at least responds to api calls.

ie

openapi-generator generate -g nodejs-server -i api.yaml
cp api.yaml api/openapi.yaml
npm start

from openapi-generator.

RitwikChatterjee avatar RitwikChatterjee commented on August 25, 2024

Again, waiting for implementation of the node.js server. Can this enhancement request be voted on to figure out what to prioritize?

from openapi-generator.

davidwav avatar davidwav commented on August 25, 2024

Interested in seeing this node.js server implemented also. 👍

from openapi-generator.

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.