-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(openapi): add update
option to automatically update an only available spec file without any prompts
#579
Conversation
…an only available spec file without any prompts
Thanks for this! I'm gunna assign to @kanadgupta as he's the person primarily responsible for managing this repo. I think we already have some things in the works to help with this, but i'll see what Kanad says. |
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.
Thanks for the PR! Can you add two pieces of logic (and corresponding test cases):
- An error message if a user passes this
--updateSingleSpec
flag butapiSettingsBody.length
is greater than 1 - A warning output if a user passes in the
--id
parameter AND the--updateSingleSpec
flag (similar to this)
Also—please ignore the failing GitHub Action Dry Run step since that's a known issue with external contributors—but if you could fix the failing snapshots in the Test Suite, that'd be great. Thank you! |
Done |
Done x 2 |
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.
thanks for this!
src/cmds/openapi/index.ts
Outdated
@@ -96,6 +102,12 @@ export default class OpenAPICommand extends Command { | |||
Command.warn("We'll be using the `--create` option , so the `--id` parameter will be ignored."); | |||
} | |||
|
|||
if (updateSingleSpec && id) { | |||
Command.warn( | |||
'When using the `--id` option the `--updateSingleSpec` option is ignored, as the desired spec id is already specified.' |
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.
'When using the `--id` option the `--updateSingleSpec` option is ignored, as the desired spec id is already specified.' | |
'When using the `--id` option the `--updateSingleSpec` option is ignored as the desired spec is already specified.' |
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.
Made a few copy edits and added a tiny error case. Thanks again for the PR @shaiarmis!
@kanadgupta thanks for the additional changes, they make a lot of sense :) |
LOL just realized I don't have permissions to merge ^_^ So go ahead and merge at your leisure. |
updateSingleSpec
option to automatically update an only available spec file without any promptsupdate
option to automatically update an only available spec file without any prompts
Today when using the
rdme openapi <path> --version=<version>
command to update a spec file (selectingUpdate
in the first prompt), we're prompted for selecting an API spec file, even if there's only a single one present.🧰 Changes
This PR adds the
--updateSingleSpec
option that will instruct the CLI to not prompt the user if there's only a single spec file available, and choose it automatically.🧬 QA & Testing
rdme openapi <path> --version=<version>
, which will upload the file without any create/update prompt because there's nothing to update.rdme openapi <path> --version=<version>
once again, and selectupdate
in the first prompt and expect to see another prompt with a single option.rdme openapi <path> --version=<version> --updateSingleSpec
and expect the file to upload successfully without any prompts.