Skip to content

format tool #729

Closed
Closed
@unship

Description

@unship

I use clang-format to format proto file, but the output option section of proto file is not what I expect,

say I clang-format -i examples/proto/examplepb/a_bit_of_everything.proto

I get

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";
};
}
;
// Overwriting host entry breaks tests, so this is not done here.
external_docs : {
url:
  "https://github.com/grpc-ecosystem/grpc-gateway";
description:
  "More about gRPC-Gateway";
}
schemes : HTTP;
schemes : HTTPS;
schemes : WSS;
consumes : "application/json";
consumes : "application/x-foo-mime";
produces : "application/json";
produces : "application/x-foo-mime";
security_definitions : {
security : {
key:
  "BasicAuth";
value : {
type:
  TYPE_BASIC;
}
}
security : {
key:
  "ApiKeyAuth";
value : {
type:
  TYPE_API_KEY;
in:
  IN_HEADER;
name:
  "X-API-Key";
}
}
security : {
key:
  "OAuth2";
value : {
type:
  TYPE_OAUTH2;
flow:
  FLOW_ACCESS_CODE;
authorization_url:
  "https://example.com/oauth/authorize";
token_url:
  "https://example.com/oauth/token";
scopes : {
scope : {
key:
  "read";
value:
  "Grants read access";
}
scope : {
key:
  "write";
value:
  "Grants write access";
}
scope : {
key:
  "admin";
value:
  "Grants read and write access to administrative information";
}
}
}
}
}
security : {
security_requirement : {
key:
  "BasicAuth";
value : {};
}
security_requirement : {
key:
  "ApiKeyAuth";
value : {};
}
}
security : {
security_requirement : {
key:
  "OAuth2";
value : {
scope:
  "read";
scope:
  "write";
}
}
security_requirement : {
key:
  "ApiKeyAuth";
value : {};
}
}
responses : {
key:
  "403";
value : {
description:
  "Returned when the user does not have permission to access the resource.";
}
}
responses : {
key:
  "404";
value : {
description:
  "Returned when the resource does not exist.";
schema : {
json_schema : {
type:
  STRING;
}
}
}
}
responses : {
key:
  "418";
value : {
description:
  "I'm a teapot.";
schema : {
json_schema : {
ref:
  ".grpc.gateway.examples.examplepb.NumericEnum";
}
}
}
}
}
;

so what format tool are you using?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions