Skip to content

Commit 9e4d5e4

Browse files
authored
Group service endpoints by OpenAPI tags (#24)
1 parent 44bc971 commit 9e4d5e4

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

_examples/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ diff:
3636
git diff --color --ignore-all-space --ignore-blank-lines --exit-code .
3737

3838
swagger:
39-
echo "http://localhost:8088"
39+
@echo "Swagger UI is available at http://localhost:8088"
4040
docker run -p 8088:8080 -v $$(pwd):/docs -e SWAGGER_JSON=/docs/openapi.gen.yaml swaggerapi/swagger-ui

_examples/openapi.gen.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ components:
501501
paths:
502502
/rpc/ExampleService/Ping:
503503
post:
504+
tags: ["ExampleService"]
504505
summary: "Deprecated."
505506
deprecated: true
506507
requestBody:
@@ -541,6 +542,7 @@ paths:
541542
- $ref: '#/components/schemas/ErrorDatabaseDown'
542543
/rpc/ExampleService/GetUser:
543544
post:
545+
tags: ["ExampleService"]
544546
summary: "Deprecated: Use GetUserV2 instead."
545547
deprecated: true
546548
security:
@@ -583,6 +585,7 @@ paths:
583585
- $ref: '#/components/schemas/ErrorDatabaseDown'
584586
/rpc/ExampleService/GetUserV2:
585587
post:
588+
tags: ["ExampleService"]
586589
summary: "GetUserV2 returns user based on given userID."
587590
security:
588591
- JWT: []
@@ -626,6 +629,7 @@ paths:
626629
- $ref: '#/components/schemas/ErrorDatabaseDown'
627630
/rpc/ExampleService/FindUser:
628631
post:
632+
tags: ["ExampleService"]
629633
summary: "FindUser searches for a user using the given search filter."
630634
security:
631635
- JWT: []
@@ -672,6 +676,7 @@ paths:
672676
- $ref: '#/components/schemas/ErrorDatabaseDown'
673677
/rpc/ExampleService/ListUsers:
674678
post:
679+
tags: ["ExampleService"]
675680
summary: "ListUsers returns all users."
676681
security:
677682
- JWT: []
@@ -713,6 +718,7 @@ paths:
713718
- $ref: '#/components/schemas/ErrorDatabaseDown'
714719
/rpc/ExampleService/GetComplex:
715720
post:
721+
tags: ["ExampleService"]
716722
summary: ""
717723
requestBody:
718724
content:
@@ -752,6 +758,7 @@ paths:
752758
- $ref: '#/components/schemas/ErrorDatabaseDown'
753759
/rpc/ExampleService/GetAllOptional:
754760
post:
761+
tags: ["ExampleService"]
755762
summary: ""
756763
requestBody:
757764
content:
@@ -791,6 +798,7 @@ paths:
791798
- $ref: '#/components/schemas/ErrorDatabaseDown'
792799
/rpc/AdminService/ListUsers:
793800
post:
801+
tags: ["AdminService"]
794802
summary: ""
795803
security:
796804
- JWT: []

main.go.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ paths:
134134
{{- $deprecated := index $method.Annotations "deprecated" }}
135135
/rpc/{{$service.Name}}/{{$method.Name}}:
136136
post:
137+
tags: ["{{$service.Name}}"]
137138
summary: {{ if $deprecated }}{{ if $deprecated.Value }}{{printf "%q" (print "Deprecated: " $deprecated.Value)}}{{else}}"Deprecated."{{end}}{{else if gt (len $method.Comments) 0}}{{printf "%q" (index $method.Comments 0)}}{{else}}""{{end}}
138139
{{- if $deprecated }}
139140
deprecated: true

0 commit comments

Comments
 (0)