Skip to content

Instantly share code, notes, and snippets.

@DanaEpp
Created November 26, 2022 00:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save DanaEpp/ca4b612734e73b4cf46ae6eeab6626b6 to your computer and use it in GitHub Desktop.
Save DanaEpp/ca4b612734e73b4cf46ae6eeab6626b6 to your computer and use it in GitHub Desktop.
jq query and filter to dump the HTTP method, route and description of every endpoint in an OpenAPI 3.0 document. Usage: jq -r -f dump-endpoints.jq openapidoc.json
.paths | to_entries | map(select(.key | test("^x-") | not)) | map ( .key as $path | .value | to_entries | map( select( .key | IN("get", "put", "post", "delete", "options", "head", "patch", "trace")) | { method: .key, path: $path, summary: .value.summary?, deprecated: .value.deprecated? })[] ) | map( .method + "\t" + .path + "\t" + .summary + (if .deprecated then " (deprecated)" else "" end)) []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment