OpenAPI DocumentationΒΆ
OpenAPI documentation is already generated for our service. However, we might like to change a few things in this document.
In this page we will customize our OpenAPI document for this Echo
service.
Refer to Reference to learn more about all of the customizations.
Similar to defining HTTP bindings, you can opt to use the annotations and directly define options in the proto files or use configuration files.
document
allows you to customize the resulting OpenAPI document for this proto file. We will use it to settitle
andversion
here.- Similar to the selector we defined in the HTTP bindings, this is a dotted path to the service and
~
resolves to the current proto package. - Defining
external_docs
in the OpenAPI document only for the HTTP endpoints that are bound to theEcho
gRPC method. - Similar to the selector we had to define for the service, however here we point to a message to customize
schema
for this proto message. In this case, to set custom description and include additional validation details.
- This option allows you to customize the resulting OpenAPI document for this proto file. We will use it to set
title
andversion
here. - This option allows you to customize the schema generated for this field in the resulting OpenAPI document. Here we add custom description and extra validation details.
- This option can be used to customize operation for HTTP endpoints bound to this gRPC method.
Here, defining
external_docs
in the OpenAPI document only for the HTTP endpoints that are bound to theEcho
gRPC method.
Now you can re-generate using either Buf
or protoc
directly and notice the changes in the generated OpenAPI file.
That's it for our quick guide!