-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: Build APIv2 spec using go-swagger, annotate endpoints #62560
Conversation
/cc @mikeCRL , @piyush-singh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏
LGTM
you may want to backport this too
Reviewed 4 of 4 files at r1, 13 of 13 files at r2.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @itsbilal)
docs/generated/swagger/spec.json, line 23 at r2 (raw file):
"/health/": { "get": { "description": "Helper endpoint to check for node helath. If `ready` is true, it also checks\nif this node is fully operational and ready to accept SQL connections.\nOtherwise, this endpoint always returns a successful response (if the API\nserver is up, of course).",
node helath -> node health
This commit adds go-swagger annotations for API v2 endpoints, so that the swagger spec and by extension docs can be generated as part of `make generate`. Due to a limitation in go-swagger, the only map key type that's supported for swagger models is string, so some maps had to be modified to use that type instead. Part of cockroachdb#55947 , and the docs story around it. Release note (general change): Add docs for api v2 endpoints.
66acfc5
to
6ed1b31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @knz)
docs/generated/swagger/spec.json, line 23 at r2 (raw file):
Previously, knz (kena) wrote…
node helath -> node health
Done.
0cf9e5d
to
6f08342
Compare
This change adds a dependency on `go-swagger/go-swagger`, and uses it as part of `make generate` to regenerate the swagger spec in `docs/generated/swagger/spec.json`, whenever one of the APIv2 files in `pkg/server/` are changed. The spec, once generated, can be served as docs using the command: bin/swagger serve -p 8080 ./docs/generated/swagger/spec.json Release note (build change): Adds go-swagger dependency, updates Makefile to call it to rebuild spec in docs/generated/swagger/ which will eventually be used for API docs.
6f08342
to
41e6ed1
Compare
TFTR! bors r=knz |
Build succeeded: |
This change adds a dependency on
go-swagger/go-swagger
, anduses it as part of
make generate
to regenerate the swaggerspec in
docs/generated/swagger/spec.json
, wheneverone of the APIv2 files in
pkg/server/
are changed.The spec, once generated, can be served as docs using
the command:
Also adds related annotations to
pkg/server/api*.go
to populatesaid spec.
Part of #55947 , and the docs story around it.
Release note (general change): Add docs for api v2 endpoints.
Release note (build change): Adds go-swagger dependency, updates
Makefile to call it to rebuild spec in docs/generated/swagger/
which will eventually be used for API docs.