Skip to content

Commit 13eb8ab

Browse files
authored
feat!: switch topic separator to space (#1100)
## 🧰 Changes BREAKING CHANGE: the topic separator (i.e., what separates a command from its subcommand) has changed from a colon to a space by default. For example, `rdme openapi:validate` is now `rdme openapi validate`. The colon topic separator will continue to be supported so there is no need to change any existing commands, but all documentation and help screens will reflect the space topic separator. ## 🧬 QA & Testing Do tests still pass?
1 parent 95cc2a9 commit 13eb8ab

32 files changed

+132
-115
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,27 @@ jobs:
7373
run: npm ci && npm run build:gha
7474
working-directory: rdme-repo
7575

76-
- name: Run `openapi:validate` command
76+
- name: Run `openapi validate` command
77+
uses: ./rdme-repo/
78+
with:
79+
rdme: openapi validate oas-examples-repo/3.1/json/petstore.json
80+
81+
- name: Run `openapi validate` command (legacy topic separator)
7782
uses: ./rdme-repo/
7883
with:
7984
rdme: openapi:validate oas-examples-repo/3.1/json/petstore.json
8085

81-
- name: Run `openapi:validate` with filename in quotes
86+
- name: Run `openapi validate` with filename in quotes
8287
uses: ./rdme-repo/
8388
with:
84-
rdme: openapi:validate "oas-examples-repo/3.1/json/petstore.json"
89+
rdme: openapi validate "oas-examples-repo/3.1/json/petstore.json"
8590

86-
- name: Run `openapi:validate` on an invalid file
91+
- name: Run `openapi validate` on an invalid file
8792
uses: ./rdme-repo/
8893
id: openapi-validate-fail
8994
continue-on-error: true
9095
with:
91-
rdme: openapi:validate rdme-repo/__tests__/__fixtures__/invalid-oas.json
96+
rdme: openapi validate rdme-repo/__tests__/__fixtures__/invalid-oas.json
9297

9398
- name: Assert that previous validation step failed
9499
if: ${{ steps.openapi-validate-fail.outcome == 'failure' }}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ To run test commands, swap out `rdme` for `bin/dev.js`. For example:
1212

1313
```sh
1414
# if the production command you're testing looks like this...
15-
rdme openapi:validate __tests__/__fixtures__/ref-oas/petstore.json
15+
rdme openapi validate __tests__/__fixtures__/ref-oas/petstore.json
1616

1717
# ... your local test command will look like this:
18-
bin/dev.js openapi:validate __tests__/__fixtures__/ref-oas/petstore.json
18+
bin/dev.js openapi validate __tests__/__fixtures__/ref-oas/petstore.json
1919
```
2020

2121
The `bin/dev.js` file has a few features that are useful for local development:
@@ -27,7 +27,7 @@ The `bin/dev.js` file has a few features that are useful for local development:
2727

2828
```sh
2929
npm run build
30-
bin/run.js openapi:validate __tests__/__fixtures__/ref-oas/petstore.json
30+
bin/run.js openapi validate __tests__/__fixtures__/ref-oas/petstore.json
3131
```
3232

3333
Your changes to the command code may make changes to [the command reference documents](./documentation/commands) — it is up to you whether you include those changes in your PR or if you let the release process take care of it. More information on that can be found in [`MAINTAINERS.md`](./MAINTAINERS.md).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ npm install rdme --save-dev
8181
Once installed in your project, you can use the `npx` prefix (which is included if you have `npm` installed) to run your CLI commands locally. For example:
8282

8383
```sh
84-
npx rdme openapi:validate [file]
84+
npx rdme openapi validate [file]
8585
```
8686

8787
To ensure you're getting the latest features and security updates, we recommend using a tool like [Dependabot](https://docs.github.com/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates) to keep `rdme` (and your other dependencies) up-to-date.

__tests__/commands/categories/create.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { runCommandAndReturnResult } from '../../helpers/oclif.js';
88
const key = 'API_KEY';
99
const version = '1.0.0';
1010

11-
describe('rdme categories:create', () => {
11+
describe('rdme categories create', () => {
1212
let run: (args?: string[]) => Promise<string>;
1313

1414
beforeAll(() => {

__tests__/commands/docs/prune.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const fixturesBaseDir = '__fixtures__/docs';
1111
const key = 'API_KEY';
1212
const version = '1.0.0';
1313

14-
describe('rdme docs:prune', () => {
14+
describe('rdme docs prune', () => {
1515
const folder = `./__tests__/${fixturesBaseDir}/delete-docs`;
1616
let run: (args?: string[]) => Promise<string>;
1717

@@ -162,10 +162,10 @@ describe('rdme docs:prune', () => {
162162
versionMock.done();
163163
});
164164

165-
describe('rdme guides:prune', () => {
165+
describe('rdme guides prune', () => {
166166
it('should error if no folder provided', async () => {
167167
return expect(
168-
(await runCommandWithHooks(['guides:prune', '--key', key, '--version', version])).error.message,
168+
(await runCommandWithHooks(['guides', 'prune', '--key', key, '--version', version])).error.message,
169169
).toContain('Missing 1 required arg:\nfolder');
170170
});
171171
});

__tests__/commands/openapi/__snapshots__/inspect.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`rdme openapi:inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/readme.…' (w/ [ 'polymorphism' ]) 1`] = `
3+
exports[`rdme openapi inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/readme.…' (w/ [ 'polymorphism' ]) 1`] = `
44
"
55
polymorphism:
66
· #/components/responses/authForbidden/content/application~1json/schema
@@ -50,7 +50,7 @@ polymorphism:
5050
· #/paths/~1version/post/responses/400/content/application~1json/schema"
5151
`;
5252

53-
exports[`rdme openapi:inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/readme-…' (w/ [ 'readme' ]) 1`] = `
53+
exports[`rdme openapi inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/readme-…' (w/ [ 'readme' ]) 1`] = `
5454
"
5555
x-default: You do not use this.
5656
x-readme.code-samples:
@@ -76,7 +76,7 @@ x-readme.samples-languages:
7676
· swift"
7777
`;
7878

79-
exports[`rdme openapi:inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'additionalProperties', …(1) ]) 1`] = `
79+
exports[`rdme openapi inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'additionalProperties', …(1) ]) 1`] = `
8080
"
8181
additionalProperties:
8282
· #/components/schemas/BodyPart/properties/headers/additionalProperties
@@ -97,7 +97,7 @@ circularRefs:
9797
· #/components/schemas/ZoneOffset/properties/rules"
9898
`;
9999

100-
exports[`rdme openapi:inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'additionalProperties', …(2) ]) 1`] = `
100+
exports[`rdme openapi inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'additionalProperties', …(2) ]) 1`] = `
101101
"
102102
additionalProperties:
103103
· #/components/schemas/BodyPart/properties/headers/additionalProperties
@@ -125,7 +125,7 @@ x-readme.proxy-enabled: You do not use this.
125125
x-readme.samples-languages: You do not use this."
126126
`;
127127

128-
exports[`rdme openapi:inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'circularRefs', 'readme' ]) 1`] = `
128+
exports[`rdme openapi inspect > feature reports > should generate a report for '@readme/oas-examples/3.0/json/schema-…' (w/ [ 'circularRefs', 'readme' ]) 1`] = `
129129
"
130130
circularRefs:
131131
· #/components/schemas/MultiPart/properties/parent
@@ -139,7 +139,7 @@ x-readme.proxy-enabled: You do not use this.
139139
x-readme.samples-languages: You do not use this."
140140
`;
141141

142-
exports[`rdme openapi:inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/petstore.json 1`] = `
142+
exports[`rdme openapi inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/petstore.json 1`] = `
143143
"Here are some interesting things we found in your API definition. 🕵️
144144
145145
· You are using 4 Media Types throughout your API: application/json, application/x-www-form-urlencoded, application/xml, and multipart/form-data
@@ -249,7 +249,7 @@ ReadMe-Specific Features and Extensions
249249
"
250250
`;
251251

252-
exports[`rdme openapi:inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/readme.json 1`] = `
252+
exports[`rdme openapi inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/readme.json 1`] = `
253253
"Here are some interesting things we found in your API definition. 🕵️
254254
255255
· You are using 2 Media Types throughout your API: application/json and multipart/form-data
@@ -359,7 +359,7 @@ ReadMe-Specific Features and Extensions
359359
"
360360
`;
361361

362-
exports[`rdme openapi:inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/readme-extensions.json 1`] = `
362+
exports[`rdme openapi inspect > full reports > should generate a report for @readme/oas-examples/3.0/json/readme-extensions.json 1`] = `
363363
"Here are some interesting things we found in your API definition. 🕵️
364364
365365
· You are using a single Media Type throughout your API: application/json

__tests__/commands/openapi/__snapshots__/validate.test.ts.snap

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (github flag enabled) 1`] = `
3+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (github flag enabled) 1`] = `
44
"
55
Your GitHub Actions workflow file has been created! ✨
66
@@ -10,7 +10,7 @@ Almost done! Push your newly created file (.github/workflows/validate-test-opt-s
1010
"
1111
`;
1212

13-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (github flag enabled) 2`] = `
13+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (github flag enabled) 2`] = `
1414
"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z
1515
# You can view our full documentation here: https://docs.readme.com/docs/rdme
1616
name: ReadMe GitHub Action 🦉
@@ -30,14 +30,14 @@ jobs:
3030
- name: Check out repo 📚
3131
uses: actions/checkout@v4
3232
33-
- name: Run \`openapi:validate\` command 🚀
33+
- name: Run \`openapi validate\` command 🚀
3434
uses: readmeio/rdme@v7
3535
with:
36-
rdme: openapi:validate __tests__/__fixtures__/petstore-simple-weird-version.json
36+
rdme: openapi validate __tests__/__fixtures__/petstore-simple-weird-version.json
3737
"
3838
`;
3939

40-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (including workingDirectory) 1`] = `
40+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (including workingDirectory) 1`] = `
4141
"
4242
Your GitHub Actions workflow file has been created! ✨
4343
@@ -47,7 +47,7 @@ Almost done! Push your newly created file (.github/workflows/validate-test-opt-s
4747
"
4848
`;
4949

50-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (including workingDirectory) 2`] = `
50+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt (including workingDirectory) 2`] = `
5151
"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z
5252
# You can view our full documentation here: https://docs.readme.com/docs/rdme
5353
name: ReadMe GitHub Action 🦉
@@ -67,14 +67,14 @@ jobs:
6767
- name: Check out repo 📚
6868
uses: actions/checkout@v4
6969
70-
- name: Run \`openapi:validate\` command 🚀
70+
- name: Run \`openapi validate\` command 🚀
7171
uses: readmeio/rdme@v7
7272
with:
73-
rdme: openapi:validate petstore.json --workingDirectory=./__tests__/__fixtures__/relative-ref-oas
73+
rdme: openapi validate petstore.json --workingDirectory=./__tests__/__fixtures__/relative-ref-oas
7474
"
7575
`;
7676

77-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt 1`] = `
77+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt 1`] = `
7878
"
7979
Your GitHub Actions workflow file has been created! ✨
8080
@@ -84,7 +84,7 @@ Almost done! Push your newly created file (.github/workflows/validate-test-opt-s
8484
"
8585
`;
8686

87-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt 2`] = `
87+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via opt 2`] = `
8888
"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z
8989
# You can view our full documentation here: https://docs.readme.com/docs/rdme
9090
name: ReadMe GitHub Action 🦉
@@ -104,14 +104,14 @@ jobs:
104104
- name: Check out repo 📚
105105
uses: actions/checkout@v4
106106
107-
- name: Run \`openapi:validate\` command 🚀
107+
- name: Run \`openapi validate\` command 🚀
108108
uses: readmeio/rdme@v7
109109
with:
110-
rdme: openapi:validate __tests__/__fixtures__/petstore-simple-weird-version.json
110+
rdme: openapi validate __tests__/__fixtures__/petstore-simple-weird-version.json
111111
"
112112
`;
113113

114-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via prompts 1`] = `
114+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via prompts 1`] = `
115115
"
116116
Your GitHub Actions workflow file has been created! ✨
117117
@@ -121,7 +121,7 @@ Almost done! Push your newly created file (.github/workflows/validate-test-file.
121121
"
122122
`;
123123

124-
exports[`rdme openapi:validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via prompts 2`] = `
124+
exports[`rdme openapi validate > GHA onboarding E2E tests > should create GHA workflow if user passes in spec via prompts 2`] = `
125125
"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z
126126
# You can view our full documentation here: https://docs.readme.com/docs/rdme
127127
name: ReadMe GitHub Action 🦉
@@ -141,14 +141,14 @@ jobs:
141141
- name: Check out repo 📚
142142
uses: actions/checkout@v4
143143
144-
- name: Run \`openapi:validate\` command 🚀
144+
- name: Run \`openapi validate\` command 🚀
145145
uses: readmeio/rdme@v7
146146
with:
147-
rdme: openapi:validate __tests__/__fixtures__/petstore-simple-weird-version.json
147+
rdme: openapi validate __tests__/__fixtures__/petstore-simple-weird-version.json
148148
"
149149
`;
150150

151-
exports[`rdme openapi:validate > error handling > should throw an error if an invalid API definition has many errors 1`] = `
151+
exports[`rdme openapi validate > error handling > should throw an error if an invalid API definition has many errors 1`] = `
152152
[SyntaxError: OpenAPI schema validation failed.
153153
154154
REQUIRED must have required property 'url'
@@ -172,9 +172,9 @@ ADDITIONAL PROPERTY must NOT have additional properties
172172
29 | "summary": "Finds Pets by status",]
173173
`;
174174
175-
exports[`rdme openapi:validate > error handling > should throw an error if an invalid OpenAPI 3.0 definition is supplied 1`] = `[MissingPointerError: Token "Error" does not exist.]`;
175+
exports[`rdme openapi validate > error handling > should throw an error if an invalid OpenAPI 3.0 definition is supplied 1`] = `[MissingPointerError: Token "Error" does not exist.]`;
176176
177-
exports[`rdme openapi:validate > error handling > should throw an error if an invalid OpenAPI 3.1 definition is supplied 1`] = `
177+
exports[`rdme openapi validate > error handling > should throw an error if an invalid OpenAPI 3.1 definition is supplied 1`] = `
178178
[SyntaxError: OpenAPI schema validation failed.
179179
180180
REQUIRED must have required property 'name'
@@ -188,7 +188,7 @@ REQUIRED must have required property 'name'
188188
29 | }]
189189
`;
190190
191-
exports[`rdme openapi:validate > error handling > should throw an error if an invalid Swagger definition is supplied 1`] = `
191+
exports[`rdme openapi validate > error handling > should throw an error if an invalid Swagger definition is supplied 1`] = `
192192
[SyntaxError: Swagger schema validation failed.
193193
194194
ADDITIONAL PROPERTY must NOT have additional properties

__tests__/commands/openapi/convert.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { runCommandAndReturnResult } from '../../helpers/oclif.js';
88

99
const successfulConversion = () => 'Your API definition has been converted and bundled and saved to output.json!';
1010

11-
describe('rdme openapi:convert', () => {
11+
describe('rdme openapi convert', () => {
1212
let run: (args?: string[]) => Promise<string>;
1313
let testWorkingDir: string;
1414

__tests__/commands/openapi/inspect.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { describe, it, expect, beforeAll } from 'vitest';
77
import Command from '../../../src/commands/openapi/inspect.js';
88
import { runCommandAndReturnResult } from '../../helpers/oclif.js';
99

10-
describe('rdme openapi:inspect', () => {
10+
describe('rdme openapi inspect', () => {
1111
let run: (args?: string[]) => Promise<unknown>;
1212

1313
beforeAll(() => {

__tests__/commands/openapi/reduce.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const successfulReduction = () => 'Your reduced API definition has been saved to
1313
let consoleInfoSpy: MockInstance;
1414
const getCommandOutput = () => consoleInfoSpy.mock.calls.join('\n\n');
1515

16-
describe('rdme openapi:reduce', () => {
16+
describe('rdme openapi reduce', () => {
1717
let run: (args?: string[]) => Promise<unknown>;
1818
let testWorkingDir: string;
1919

0 commit comments

Comments
 (0)