@@ -161,7 +161,7 @@ message List{{.TableName}}Request {
161161}
162162
163163message List{{.TableName}}Reply {
164- int64 total =1;
164+ int64 total = 1;
165165 repeated {{.TableName}} {{.TName}}s = 2;
166166}
167167
@@ -265,7 +265,7 @@ message List{{.TableName}}Request {
265265}
266266
267267message List{{.TableName}}Reply {
268- int64 total =1;
268+ int64 total = 1;
269269 repeated {{.TableName}} {{.TName}}s = 2;
270270}
271271`
@@ -320,6 +320,12 @@ service {{.TName}} {
320320 option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
321321 summary: "create {{.TName}}",
322322 description: "submit information to create {{.TName}}",
323+ //security: {
324+ // security_requirement: {
325+ // key: "BearerAuth";
326+ // value: {}
327+ // }
328+ //}
323329 };
324330 }
325331
@@ -465,17 +471,20 @@ service {{.TName}} {
465471 }
466472}
467473
474+
468475// Some notes on defining fields under message:
469476// (1) Fill in the validate rules https://github.com/envoyproxy/protoc-gen-validate#constraint-rules
470- // (2) When using the protoc-gen-openapiv2 plugin, if the defined fields are snake case,
471- // you must add annotations for snake case names, such as string foo_bar = 1 [json_name = "foo_bar"],
477+ // (2) Suggest using camel hump naming for message field names, and for names ending in 'id',
478+ // use xxxID naming format, such as userID, orderID, etc.
479+ // (3) When using the protoc-gen-openapiv2 plugin, if the defined fields are snake case,
480+ // you must add annotations for snake case names, such as string fieldName = 1 [json_name = "field_name"],
472481// to ensure that the front end and back end JSON naming is consistent.
473- // (3 ) If the route contains the path parameter, such as /api/v1/userExample/{id}, the defined
482+ // (4 ) If the route contains the path parameter, such as /api/v1/userExample/{id}, the defined
474483// message must contain the name of the path parameter and the name should be
475484// added with a new tag, such as int64 id = 1 [(tagger.tags) = "uri:\"id\""];
476- // (4 ) If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
485+ // (5 ) If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
477486// a form tag must be added when defining the query parameter in the message,
478- // such as string name = 1 [(tagger.tags) = "form:\"name\""];
487+ // such as string name = 1 [(tagger.tags) = "form:\"name\""].
479488
480489
481490// protoMessageCreateCode
@@ -513,7 +522,7 @@ message List{{.TableName}}Request {
513522}
514523
515524message List{{.TableName}}Reply {
516- int64 total =1;
525+ int64 total = 1;
517526 repeated {{.TableName}} {{.TName}}s = 2;
518527}
519528
@@ -602,6 +611,12 @@ service {{.TName}} {
602611 option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
603612 summary: "create {{.TName}}",
604613 description: "submit information to create {{.TName}}",
614+ //security: {
615+ // security_requirement: {
616+ // key: "BearerAuth";
617+ // value: {}
618+ // }
619+ //}
605620 };
606621 }
607622
@@ -676,17 +691,20 @@ service {{.TName}} {
676691 }
677692}
678693
694+
679695// Some notes on defining fields under message:
680696// (1) Fill in the validate rules https://github.com/envoyproxy/protoc-gen-validate#constraint-rules
681- // (2) When using the protoc-gen-openapiv2 plugin, if the defined fields are snake case,
682- // you must add annotations for snake case names, such as string foo_bar = 1 [json_name = "foo_bar"],
697+ // (2) Suggest using camel hump naming for message field names, and for names ending in 'id',
698+ // use xxxID naming format, such as userID, orderID, etc.
699+ // (3) When using the protoc-gen-openapiv2 plugin, if the defined fields are snake case,
700+ // you must add annotations for snake case names, such as string fieldName = 1 [json_name = "field_name"],
683701// to ensure that the front end and back end JSON naming is consistent.
684- // (3 ) If the route contains the path parameter, such as /api/v1/userExample/{id}, the defined
702+ // (4 ) If the route contains the path parameter, such as /api/v1/userExample/{id}, the defined
685703// message must contain the name of the path parameter and the name should be
686704// added with a new tag, such as int64 id = 1 [(tagger.tags) = "uri:\"id\""];
687- // (4 ) If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
705+ // (5 ) If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
688706// a form tag must be added when defining the query parameter in the message,
689- // such as string name = 1 [(tagger.tags) = "form:\"name\""];
707+ // such as string name = 1 [(tagger.tags) = "form:\"name\""].
690708
691709
692710// protoMessageCreateCode
@@ -724,7 +742,7 @@ message List{{.TableName}}Request {
724742}
725743
726744message List{{.TableName}}Reply {
727- int64 total =1;
745+ int64 total = 1;
728746 repeated {{.TableName}} {{.TName}}s = 2;
729747}
730748`
0 commit comments