Skip to content

[Protobuf-Schema] Namespace updates#11115

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
Yurzel:protobuf-namespace-update
Dec 17, 2021
Merged

[Protobuf-Schema] Namespace updates#11115
wing328 merged 2 commits intoOpenAPITools:masterfrom
Yurzel:protobuf-namespace-update

Conversation

@Yurzel
Copy link
Copy Markdown
Contributor

@Yurzel Yurzel commented Dec 14, 2021

resolve #11114

Codegen

  • fixed default packageName to openapitools
  • api mustache packageName changed to {{packageName}}.{{apiPackage}}.{{classname}}
  • package name changed to lowercase following the protobuf convention

syntax = "proto3";

package petstore;
package petstore.services.storeservice;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would "petstore.services.store_service" be a better package name?

If that's the case, then I think we should use the lambda.underscore instead of lambda.lowercase.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't even like to put "class name" into the package. The official documentations says this:

Packages
Package name should be in lowercase, and should correspond to the directory hierarchy. e.g., if a file is in my/package/, then the package name should be my.package.

There is also an another way(?) to keep the original package name and then use some kind of prefix/postfix to the Request/Response message itself. I'm scared of ugly code generated by protoc tho.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the prompt reply and sorry that I forgot to mention why I think underscore should be used. It's based on this SO answer: https://stackoverflow.com/a/63228588/677735

@wing328 wing328 added this to the 5.3.1 milestone Dec 14, 2021
@wing328 wing328 merged commit 9b65513 into OpenAPITools:master Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQ][Protobuf-Schema] Multiple services, same method collision

2 participants