55After cloning this repo...
66
77``` shell
8- npm install -g . && npm install -g swagger-repo
8+ npm install -g . && npm install -g swagger-repo && npm install -g redoc-cli
99```
1010
1111## Set up
@@ -14,19 +14,20 @@ Within a repo directory that contains an OpenAPI spec, create a config file name
1414
1515``` json
1616{
17- "apiSpecPath" : " openapi/swagger .yaml" ,
17+ "apiSpecPath" : " openapi/openapi .yaml" ,
1818 "contactUrl" : " "
1919}
2020```
2121
22+ ** Note:** an OpenAPI spec for testing can be found at [ ` test/test-spec/combined/openapi.yaml ` ] ( test/test-spec/combined/openapi.yaml ) .
23+
2224## Outputs
2325
24- This package is designed to create artifacts in the following locations :
26+ This package is designed to create artifacts in the following path(s) :
2527
26- - ` {branchPath}/docs/ ` (not currently implemented; might be replaced by ReDoc)
27- - ` {branchPath}/swagger-ui/ ` (might be replaced by ReDoc)
28- - ` {branchPath}/redoc-ui/ ` (not currently implemented)
29- - ` shared/ ` (common assets to use for Swagger UI; might be irrelevant with switch to ReDoc)
28+ - ` {branchPath}/docs/index.html `
29+ - ` {branchPath}/openapi.json `
30+ - ` {branchPath}/openapi.yaml `
3031
3132Where ` branchPath ` is the repo root if the current branch is ` master ` , otherwise ` preview/<branchName> ` .
3233
@@ -41,7 +42,7 @@ gh-openapi-docs
4142You should see console logs that look like this:
4243
4344``` shell
44- { apiSpecPath: ' openapi/swagger .yaml' ,
45+ { apiSpecPath: ' openapi/openapi .yaml' ,
4546 docsRoot: ' docs' ,
4647 uiRoot: ' swagger-ui' ,
4748 redocRoot: ' redoc-ui' ,
@@ -52,32 +53,34 @@ You should see console logs that look like this:
5253 abbreviatedSha: ' <abbreviated-commit-sha>' ,
5354 branch: ' develop' ,
5455 tag: null,
55- committer: null,
56- committerDate: null,
57- author: null,
58- authorDate: null,
59- commitMessage: null,
60- root:
61- ' <repo-path>' ,
62- commonGitDir:
63- ' <repo-path>/.git' ,
64- worktreeGitDir:
65- ' <repo-path>/.git' ,
56+ committer:
' James Eddy <[email protected] >' ,
57+ committerDate: ' 2020-03-13T05:25:03.000Z' ,
58+ author:
' James Eddy <[email protected] >' ,
59+ authorDate: ' 2020-03-13T05:25:03.000Z' ,
60+ commitMessage: ' replace swagger-ui and docs with redoc (for both)' ,
61+ root: ' <repo-path>' ,
62+ commonGitDir: ' <repo-path>/.git' ,
63+ worktreeGitDir: ' <repo-path>/.git' ,
6664 lastTag: null,
67- commitsSinceLastTag: Infinity ,
65+ commitsSinceLastTag: 0 ,
6866 env: undefined,
6967 repoOrigin:
7068 ' https://github.com/<gh-org>/<repo-name>' ,
7169 branchPath:
7270 ' <repo-path>/preview/develop' }
7371
74- Preparing docs for API spec at ' openapi/swagger .yaml' (develop)
72+ Preparing docs for API spec at ' openapi/openapi .yaml' (develop)
7573Cloning ' gh-pages' branch into ' <repo-path>/.ghpages-tmp'
7674Cloning into ' .' ...
77-
7875...
76+ Branch folder:
77+ < repo-path> /preview/use-redoc
78+ Spec location:
79+ < repo-path> /openapi/openapi.yaml
7980
8081Bundling API spec...
82+ Storing to:
83+ < repo-path> /preview/develop/openapi.json
8184
8285> < repo-name
> [email protected] swagger
< repo-path
> 8386> swagger-repo " bundle" " -o" " <repo-path>/preview/develop/openapi.json"
@@ -88,10 +91,16 @@ Created "<repo-path>/preview/develop/openapi.json" openapi file.
8891> swagger-repo " bundle" " --yaml" " -o" " <repo-path>/preview/develop/openapi.yaml"
8992
9093Created " <repo-path>/preview/develop/openapi.yaml" openapi file.
91- Copying Swagger UI index to ' <repo-path>/preview/develop/swagger-ui'
92- Swagger UI folder contents:
94+ Generating OpenAPI docs index at ' <repo-path>/preview/develop/docs/index.html'
95+
96+ > < repo-name
> [email protected] redoc
< repo-path
> 97+ > redoc-cli " bundle" " <repo-path>/preview/develop/openapi.yaml" " --output" " <repo-path>/preview/develop/docs/index.html"
98+
99+ Prerendering docs
100+
101+ 🎉 bundled successfully in: < repo-path> /preview/use-redoc/docs/index.html (957 KiB) [⏱ 0.234s]
102+ OpenAPI docs folder contents:
93103index.html
94104
95- Updating API spec path for ' <repo-path>/preview/develop/swagger-ui/index.html'
96- Done (in 6s.)
105+ Done (in 13s.)
97106` ` `
0 commit comments