Scripts used in postprocessing OpenAPI document for ReDoc.
Use @apidevtools/json-schema-ref-parser to dereference the auto-generated JSON file.
Use openapi-snippet to generate code samples automatically.
A int32
type port
defined in the .proto
file is:
int32 port = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
format: "int32",
default: "8080",
example: "8080"
The default JSON generated by bufbuild/buf
is:
"port": {
"type": "integer",
"format": "int32",
"example": 8080,
"default": "8080"
}
replaceint.js
replaces all integer values and the processed JSON file is:
"port": {
"type": "integer",
"format": "int32",
"example": 8080,
"default": 8080
}
Embed external Markdown file contents to the info.description
auto-generated JSON file. See Redoc documentation for more information.
Apply JSON patch to the auto-generated JSON file. See RFC 6902 for more information.
Add an x-tagGroups
field to the auto-generated JSON file and group all tags under that a specified tag. This field is a Redoc vendor extension. See Redoc documentation for more information.