Skip to content

LinuxGit/openapi-scripts

 
 

Repository files navigation

openapi-scripts

Scripts used in postprocessing OpenAPI document for ReDoc.

Postprocess the JSON file generated by bufbuild/buf

dereference

Use @apidevtools/json-schema-ref-parser to dereference the auto-generated JSON file.

Generate code sample

Use openapi-snippet to generate code samples automatically.

Convert the example and default values of integer type to int

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
}

Import markdown files

Embed external Markdown file contents to the info.description auto-generated JSON file. See Redoc documentation for more information.

Add x-logo

x-logo is a vendor extension from Redoc. It allows you to show a custom logo on the left upper corner of your redoc output.

Add tag group

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.

About

Dockerfiles used in PingCAP's docs CI pipeline

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.8%
  • Dockerfile 2.2%