nytimes / openapi2proto

A tool for generating Protobuf v3 schemas and gRPC service definitions from OpenAPI specifications
Apache License 2.0
964 stars 98 forks source link

GRPC Package Name #106

Closed forwardmeasure closed 5 years ago

forwardmeasure commented 5 years ago

Hello all. First of all, thank you for your wonderful work on this project!

I have a quick question regarding the package name of the generated protobuf specifications. I am running openapi2proto on the command line, and it appears that the package name is being generated from the 'title' under the 'info' message.

From the tests, it appears that one can configure this with fixtures programmatically. But, is there a way I can configure this via the command line?

Many thanks, Prashanth

jprobinson commented 5 years ago

Howdy @forwardmeasure!

At this point in time, the tool is only set to use the title of the spec or, if provided, an x-global-option can be added to declare the package names for specific languages. An example is in the README: https://github.com/NYTimes/openapi2proto#global-options

forwardmeasure commented 5 years ago

Hey mate, Thank you much for your prompt response. I actually took a different approach - I ended up writing a Swagger Code generator as an extension of the swagger-codegen project. As of now, I'm able to get a fairly complex OpeanAPI spec to produce a nice-looking (semantically correct :-) set of .protos and GRPC service definitions. But, it wouldn't have been possible if you hadn't put this project together, so thank you!

I shall be cleaning the code up and submitting a PR to the swagger repo soon!

Cheers, Prashanth