utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
290 stars 37 forks source link

swagger: add flag to add title #106

Closed KarthikNayak closed 2 years ago

KarthikNayak commented 2 years ago

Currently the title of the generated swagger file is the name of the file. This provides no user input to customize.

Let's add a new flag -swagger_title which will allow the user to provide a title and this is propagated to the lower layers and used during the swagger generation.

We still default to filename if no title is provided.

Signed-off-by: Karthik Nayak karthik.188@gmail.com

KarthikNayak commented 2 years ago

Closing this to find a better option.

bullgare commented 2 years ago

For someone who wants to know a solution, you can use swagger options for this, like here:

option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
  info: {
    title: "A Bit of Everything";
    version: "1.0";
    contact: {
      name: "gRPC-Gateway project";
      url: "https://github.com/grpc-ecosystem/grpc-gateway";
      email: "none@example.com";
    };
    license: {
      name: "BSD 3-Clause License";
      url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt";
    };
    extensions: {
      key: "x-something-something";
      value {
        string_value: "yadda";
      }
    }
  };
...

More details on options.