Skip to content
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): adding a command to resolve circular and recursive references #1063

Open
wants to merge 63 commits into
base: v9
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
59bb8f2
Adding refs to the list of openapi commands
Nov 11, 2024
d82700a
Code to execute the openapi:refs command
Nov 11, 2024
099a6f1
style: apply Prettier formatting
Nov 11, 2024
95208cf
Add 'openapi:refs' command and update related test snapshots
Nov 11, 2024
6249347
docs(openapi) command description
Nov 14, 2024
0a5f141
fix(openapi) use of a premade solution for processing a file
Nov 14, 2024
03c092c
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 14, 2024
3660917
chore: update package-lock.json
Nov 19, 2024
7ca5197
Merge branch 'next' of https://github.com/readmeio/rdme into oleh/ope…
Nov 19, 2024
597ece5
refactor: align code with recent updates
Nov 19, 2024
0b87569
Merge branch 'oleh/openapi-adding-command-to-solve-circularity-and-re…
Nov 19, 2024
3039ea0
chore: minor correction
Nov 19, 2024
dca7b9f
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 19, 2024
349b9f8
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 19, 2024
88bd34e
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 19, 2024
0a3c4e0
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 19, 2024
0c0027e
test: openapi:refs
Nov 19, 2024
18f7b4e
Merge branch 'oleh/openapi-adding-command-to-solve-circularity-and-re…
Nov 19, 2024
8fcc065
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 20, 2024
9fa0ca3
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 20, 2024
a4b1fc0
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 21, 2024
c0aa486
Merge remote-tracking branch 'origin/next' into oleh/openapi-adding-c…
Nov 22, 2024
d938932
docs: updating documentation after merge
Nov 22, 2024
44571ae
chore: small text change
Nov 22, 2024
3f1795b
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Nov 25, 2024
b01b18a
refactor: align code with recent updates
Nov 25, 2024
1d1c7e2
feat: add check and display appropriate message for files that cannot…
Nov 25, 2024
1a25b65
test: unresolvable files
Nov 25, 2024
751c52a
chore: gaps
Nov 29, 2024
19875c1
feat: processing of circularity that cannot be processed
Nov 29, 2024
43f2c82
test: unprocessable files
Nov 29, 2024
37f4d5b
chore: correction
Nov 29, 2024
e8d2b9a
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 2, 2024
b293e72
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
Dec 2, 2024
e2a0948
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 2, 2024
87bdd5e
refactor: requested changes
Dec 2, 2024
91dbb5a
chore: deleting a file
Dec 2, 2024
6de2193
chore: oops
Dec 2, 2024
a55dd14
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
Dec 2, 2024
ce09500
refactor: requested changes
Dec 2, 2024
b224ec6
fix: `openapi:refs` touch ups (#1103)
kanadgupta Dec 5, 2024
9c037c9
test: schemes without properties
Dec 5, 2024
da5b0ad
Merge remote-tracking branch 'origin' into oleh/openapi-adding-comman…
Dec 6, 2024
9249d2a
chore: minor updates
Dec 6, 2024
dd02080
Revert "chore: minor updates"
Dec 6, 2024
4355f9c
chore: minor updates
Dec 6, 2024
a7d8555
chore: lint
Dec 6, 2024
f010a7d
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 6, 2024
f7e52bf
feat: processing schemas with only (beta)
Dec 7, 2024
8bcf655
Merge branch 'oleh/openapi-adding-command-to-solve-circularity-and-re…
Dec 7, 2024
2667d1b
chore: lint
Dec 7, 2024
1d119f2
chore: cleanup
Dec 8, 2024
e790dec
chore: cleanup
Dec 9, 2024
ae39d1e
test: complex case
Dec 9, 2024
6e65d9f
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 9, 2024
91958bd
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 9, 2024
09b8039
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 10, 2024
4011248
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 11, 2024
0400bae
Merge branch 'next' into oleh/openapi-adding-command-to-solve-circula…
olehshh Dec 12, 2024
5df03c2
Merge branch 'v9' into oleh/openapi-adding-command-to-solve-circulari…
olehshh Dec 13, 2024
3721546
Merge branch 'v9' into oleh/openapi-adding-command-to-solve-circulari…
olehshh Dec 17, 2024
304072d
chore: suggestion to contact support in case of certain errors
Dec 17, 2024
ec3768a
chore: cleanup
Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "chore: minor updates"
This reverts commit 9249d2a.
Oleh Shumov committed Dec 6, 2024
commit dd0208075b230d5fe44c5dcbe0db7a88924d7f1b
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ $ npm install -g rdme
$ rdme COMMAND
running command...
$ rdme (--version)
rdme/9.0.0-next.35 darwin-arm64 node-v20.13.1
rdme/9.0.0-next.35 linux-x64 node-v20.18.1
$ rdme --help [COMMAND]
USAGE
$ rdme COMMAND

This file was deleted.

11 changes: 5 additions & 6 deletions documentation/commands/openapi.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ Manage your API definition (e.g., syncing, validation, analysis, conversion, etc
* [`rdme openapi convert [SPEC]`](#rdme-openapi-convert-spec)
* [`rdme openapi inspect [SPEC]`](#rdme-openapi-inspect-spec)
* [`rdme openapi reduce [SPEC]`](#rdme-openapi-reduce-spec)
* [`rdme openapi refs [SPEC]`](#rdme-openapi-refs-spec)
* [`rdme openapi validate [SPEC]`](#rdme-openapi-validate-spec)

## `rdme openapi [SPEC]`
@@ -227,13 +226,13 @@ EXAMPLES
$ rdme openapi reduce petstore.json --path /pet/{id} --method get --method put --out petstore.reduced.json
```

## `rdme openapi refs [SPEC]`
## `rdme openapi:refs [SPEC]`

Resolves circular and recursive references in OpenAPI by replacing them with object schemas.

```
USAGE
$ rdme openapi refs [SPEC] [--out <value>] [--workingDirectory <value>]
$ rdme openapi:refs [SPEC] [--out <value>] [--workingDirectory <value>]

ARGUMENTS
SPEC A file/URL to your API definition
@@ -255,16 +254,16 @@ DESCRIPTION
EXAMPLES
This will resolve circular and recursive references in the OpenAPI definition at the given file or URL:

$ rdme openapi refs [url-or-local-path-to-file]
$ rdme openapi:refs [url-or-local-path-to-file]

You can omit the file name and `rdme` will scan your working directory (and any subdirectories) for OpenAPI files.
This approach will provide you with CLI prompts, so we do not recommend this technique in CI environments.

$ rdme openapi refs
$ rdme openapi:refs

If you wish to automate this command, you can pass in CLI arguments to bypass the prompts:

$ rdme openapi refs petstore.json --out petstore.openapi.json
$ rdme openapi:refs petstore.json --out petstore.openapi.json
```

## `rdme openapi validate [SPEC]`
2 changes: 1 addition & 1 deletion src/lib/prepareOas.ts
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ const capitalizeSpecType = (type: string) =>
*/
export default async function prepareOas(
path: string | undefined,
command: 'openapi convert' | 'openapi inspect' | 'openapi reduce' | 'openapi refs' | 'openapi validate' | 'openapi',
command: 'openapi convert' | 'openapi inspect' | 'openapi reduce' | 'openapi validate' | 'openapi',
opts: {
/**
* Optionally convert the supplied or discovered API definition to the latest OpenAPI release.