Skip to content

feat(docs): add --method flag to docs endpoint - #302

Draft
cvkramer wants to merge 1 commit into
mainfrom
fix/docs-endpoint-method
Draft

cvkramer wants to merge 1 commit into
mainfrom
fix/docs-endpoint-method

Conversation

@cvkramer

Copy link
Copy Markdown

What

Adds --method get|post|put|patch|delete (case-insensitive) to docs endpoint <path>, scoping the printed schema to one HTTP method instead of every method the path defines. An unrecognized value, or a valid method the path doesn't define, exits 2 with a message listing the methods the path does define. Omitting --method keeps the existing all-methods output.

Why

docs endpoint had no way to view a single method's schema on a path that defines several, forcing users to scan the full output by hand.

Bead: global-w291.4
Fixes #297

Verification

  • go build ./..., go vet ./... — clean
  • go test ./... — ok, all packages
  • go test -count=1 -shuffle=on ./... — ok, all packages
  • golangci-lint run --timeout=3m ./... (v2.15.0, pinned) — 0 issues
  • New tests in cmd/docs_openapi_test.go (filter to one method, case-insensitivity, unchanged default, unknown method value, valid-but-undefined method) confirmed failing before the fix (no such flag -method) and passing after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs endpoint rejects --method flag; no way to scope schema to one HTTP method

1 participant