danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
717 stars 69 forks source link

feat: document args/options schemas, fixes #157 #212

Closed danielgtaylor closed 11 months ago

danielgtaylor commented 11 months ago

Since the built-in --help generator only gives a name of each argument and a short text description of each option, this PR adds schema information for both to the generated description. There are two groups: 1. path parameter arguments and 2. query param / header arguments. Each is rendered as an object where the keys are the parameter name and the schema for each is shown next to it, similar to how the request/response body schemas work.

To take the example in #157, it now produces this to describe the image type argument:

Screenshot 2023-08-03 at 22 21 33
codecov[bot] commented 11 months ago

Codecov Report

Merging #212 (6b1980e) into main (6b9ecae) will increase coverage by 0.12%. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/danielgtaylor/restish/pull/212/graphs/tree.svg?width=650&height=150&src=pr&token=1BMagYibk9&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor)](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor) ```diff @@ Coverage Diff @@ ## main #212 +/- ## ========================================== + Coverage 75.63% 75.76% +0.12% ========================================== Files 26 26 Lines 3555 3574 +19 ========================================== + Hits 2689 2708 +19 Misses 666 666 Partials 200 200 ``` | [Files Changed](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor) | Coverage Δ | | |---|---|---| | [openapi/openapi.go](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor#diff-b3BlbmFwaS9vcGVuYXBpLmdv) | `88.48% <100.00%> (+0.56%)` | :arrow_up: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor). Last update [6b9ecae...6b1980e](https://app.codecov.io/gh/danielgtaylor/restish/pull/212?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniel+G.+Taylor).