redocly / create-openapi-repo Goto Github PK
View Code? Open in Web Editor NEW🤖 Generator for GH repo to help you manage the OpenAPI definition lifecycle
License: MIT License
🤖 Generator for GH repo to help you manage the OpenAPI definition lifecycle
License: MIT License
Repro steps:
yarn global add create-openapi-repo
mkdir apiDocs
cd apiDocs
cp /path/to/preexistingopenapi.yaml .
create-openapi-repo
Output:
$ create-openapi-repo
Welcome to the OpenAPI-Repo generator!
? Do you already have an OpenAPI/Swagger 3.0 definition for your API? Yes
? Please specify the path to the OpenAPI definition (local file): ./openapi.yaml
? API Name: Read/Write API
? The following folders will be created: openapi and docs
You can change them by running create-openapi-repo <openapiDir> <docsDir>
Proceed? Yes
Creating a new OpenAPI repo in /home/julian/Projects/nodebb/apidocs
(node:29459) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'parameters' of undefined
at module.exports (/home/julian/.config/yarn/global/node_modules/create-openapi-repo/lib/split-definition.js:84:29)
at run (/home/julian/.config/yarn/global/node_modules/create-openapi-repo/cli.js:196:3)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:29459) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29459) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Node.js v13.8.0
[email protected] /usr/lib/node_modules/npm
yarn 1.21.1
I've found this API by stumbling on it via the ReDoc repo. Seems like this is what I want to use in order to combine all OpenAPI YAML files into a single JSON/YAML file.
However, I've noticed a few things that are just broken (version 0.0.2):
node_modules/.bin/openapi-cli
file that has the following example/test content:
'use strict';
exports.validate = function() {
console.log("This is my first npm");
};
node ./node_modules/.bin/openapi -h
, or any other command, I get the following error message:
/Users/{redacted}/site/public/developers/api-reference/node_modules/simple-websocket/server.js:45
_handleListening = () => {
^
√ api-reference % ./node_modules/.bin/openapi-cli -h (master)api-reference
./node_modules/.bin/openapi-cli: line 1: use strict: command not found
./node_modules/.bin/openapi-cli: line 3: syntax error near unexpected token `('
./node_modules/.bin/openapi-cli: line 3: `exports.validate = function() {'
?2 api-reference % node ./node_modules/.bin/openapi-cli -h (master)api-reference
√ api-reference % node ./node_modules/.bin/openapi -h (master)api-reference
/Users/{redacted}/site/public/developers/api-reference/node_modules/simple-websocket/server.js:45
_handleListening = () => {
^
SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/Users/{redacted}/site/public/developers/api-reference/node_modules/@redocly/openapi-cli/lib/cli/preview-server/server.js:6:22)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
I'm getting deploy error with github
> [email protected] deploy /home/travis/build/moe-lk/apidoc
> npm run build && deploy-to-gh-pages --update web_deploy
> [email protected] build /home/travis/build/moe-lk/apidoc
> node ./scripts/build.js
> [email protected] swagger /home/travis/build/moe-lk/apidoc
> swagger-repo "bundle" "-o" "web_deploy/swagger.json"
Adding code samples to spec
Running plugins
Plugins folder not found. Skip.
Created "web_deploy/swagger.json" swagger file.
> [email protected] swagger /home/travis/build/moe-lk/apidoc
> swagger-repo "bundle" "--yaml" "-o" "web_deploy/swagger.yaml"
Adding code samples to spec
Running plugins
Plugins folder not found. Skip.
Created "web_deploy/swagger.yaml" swagger file.
You need to setup GH_TOKEN environment variable
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `npm run build && deploy-to-gh-pages --update web_deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/travis/.npm/_logs/2018-11-14T12_08_24_406Z-debug.log
Script failed with status 1
with travis-ci
$ npm install -g generator-openapi-repo
> [email protected] prepublish /home/adam/Projects/generator-openapi-repo
> gulp prepublish
sh: 1: gulp: not found
npm ERR! addLocal Could not install /home/adam/Projects/generator-openapi-repo
npm ERR! Linux 4.2.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "generator-openapi-repo"
npm ERR! node v4.0.0
npm ERR! npm v3.10.8
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] prepublish: `gulp prepublish`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] prepublish script 'gulp prepublish'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the generator-openapi-repo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp prepublish
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs generator-openapi-repo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls generator-openapi-repo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/adam/Projects/npm-debug.log
I've really enjoyed using the tool for my project documentation.
In addition to API specs, however, I'm also hosting a lot of general software design documentation (that doesn't involve REST API paths at all, like class overview, state diagrams, execution concept & flow, etc.) using Markdown. Right now I'm using tags + x-tagGroups, where the description
field for some tags can be hundreds and thousands of lines of Markdown, and it's all crammed inside spec/swagger.yaml
.
It would be extremely helpful to support storing tag descriptions in separate files in another sub-directory. Otherwise the swagger.yaml file would have 10k+ lines and collaborative documentation becomes virtually unfeasible.
IMO adding this option would greatly extend the tool and make it an ideal option for not just API spec but overall software documentation as well. Any thoughts? And thanks for the great work!
Hi,
lovely tool, thanks! We were thinking of using it in our company, but we were also considering using Stoplight Studio. However, no tools out there at the moment expect some of the splitting your tool does. Here I mean referring to markdown description files via $ref and those special filenames for paths.
Would it be possible with some flag to do the initial OpenAPI spec split only into files that the OpenAPI spec officially supports, so the repo could then be consumed by some of these editors?
Thanks.
Could be nice, isn't it?
I recently created a repo to document my APIs and I am wondering why I can't have two HTTP requests methods in the same .yaml file. Like I can no redeclare post or get or delete or put in the same file
Describe the bug:
On Windows machines, the create-openapi-repo
tool generates reference files with the backslashes.
To Reproduce:
npx create-openapi-repo
.Expected behavior:
$ref
s have to be generated with the forward slashes.
Additional details:
1.0.0-beta.82
openapi split
commandImprove the README.
Maybe we should specifically explain two use-cases:
And then better explain the structure of the resulting split repository?
I would publish a full rendered HTML of Redoc on Github Pages.
When I build it is generated only the yaml documentation, no HTML is built
npm run build
[email protected] build /Users/giovanni.marino/Docs/test
openapi bundle -o distCreated a bundle for openapi/openapi.yaml at dist/openapi.yaml
no web_deploy folder is created, only dist folder with just yaml file
to push dist folder on github pages I set gh-pages as #8
Yaml file is deployed correctly but as I said I need to push the entire redoc html
We can use swagger-codegen
to generate SDKs on Travis and store them on GitHub pages.
Hi,
I can't replace the logo.png used in redoc. I have placed the logo in /web in the master branch and it didn't work, then I placed it in /web in gh-pages branch with the same result, the default logo keeps unchanged.
This is my repo: https://github.com/SmartNodeLabs/snl-appointments-api-doc
Please can you give me some clue about what I'm doing wrong?
Best regards and thank you for your work in this project!
Hi all,
Just a note that I had to do this to do a successful migration:
rm -f spec/code_samples/README.md
Full logs FYI:
localhost ~/src/surevoip-api-spec [master*]$ create-openapi-repo --migrate-2-3
Starting create-openapi-repo migration tool...
? Please make sure you have a backup. The migration may lose some data. Proceed? Yes
Loading schemas info...
Loading code samples...
Updating paths...
(node:1420381) UnhandledPromiseRejectionWarning: Error: ENOTDIR: not a directory, scandir 'spec/code_samples/README.md'
at Object.readdirSync (fs.js:1021:3)
at injectCodeSamples (/usr/local/lib/node_modules/create-openapi-repo/lib/migrate-2-3.js:322:24)
at migrate (/usr/local/lib/node_modules/create-openapi-repo/lib/migrate-2-3.js:105:5)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async run (/usr/local/lib/node_modules/create-openapi-repo/cli.js:131:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1420381) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1420381) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
localhost ~/src/surevoip-api-spec [master*]$ gits
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
localhost ~/src/surevoip-api-spec [master*]$ ls spec/code_samples/
README.md
localhost ~/src/surevoip-api-spec [master*]$ cat spec/code_samples/README.md
Code samples
=====
[x-code-samples](https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md#x-code-samples)
Path `<lang>/<path>/<HTTP verb>.<extension>` where:
* `<lang>` - name of the language from [this](https://github.com/github/linguist/blob/master/lib/linguist/popular.yml) list.
* `<path>` - path of the target method, where all `/` are replaced with `@`.
* `<HTTP verb>` - verb of target method.
* `<extension>` - ignored.
localhost ~/src/surevoip-api-spec [master*]$ rm -f spec/code_samples/README.md
localhost ~/src/surevoip-api-spec [master*]$ create-openapi-repo --migrate-2-3
Starting create-openapi-repo migration tool...
? Please make sure you have a backup. The migration may lose some data. Proceed? Yes
Loading schemas info...
Loading code samples...
Updating paths...
Updating schemas...
Rename directory "spec" to "openapi"...
Remove redocly.yaml
Create default .redocly.yaml
Updating entrypoint openapi.yaml...
Updating package.json...
Warning: can't migrate "start" script. Use "openapi preview-docs" to preview docs.
Automatic migration completed succesfully 🎉
To finish, update dependencies by running:
yarn install
After that, verify your migration by running:
npm test
We use a new validation tool now, so it may find new issues in your API definition.
Fix or override the error levels in the corresponding rules configuration.
See the example in .redocly.yaml and on openapi-cli GitHub page.
https://github.com/Redocly/openapi-cli
All done!
localhost ~/src/surevoip-api-spec [master*]$
Thanks though!
When running yo openapi-repo
I get:
/usr/local/lib/node_modules/yo/node_modules/fast-glob/out/providers/reader-sync.js:45
throw err;
^
Error: EACCES: permission denied, scandir '/usr/sbin/authserver'
at Object.fs.readdirSync (fs.js:924:18)
at exports.readdir (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
at Object.safeCall [as safe] (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/call.js:24:8)
at DirectoryReader.readNextDirectory (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
at Readable.DirectoryReader.stream._read (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
at Readable.read (_stream_readable.js:449:10)
at readdirSync (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/sync/index.js:27:21)
at Function.readdirSyncStat (/usr/local/lib/node_modules/yo/node_modules/@mrmlnc/readdir-enhanced/lib/index.js:34:10)
at ReaderSync.dynamicApi (/usr/local/lib/node_modules/yo/node_modules/fast-glob/out/providers/reader-sync.js:61:24)
at ReaderSync.api (/usr/local/lib/node_modules/yo/node_modules/fast-glob/out/providers/reader-sync.js:53:25)
Anyone else seen this?
I am using create-openapi-repo to create my openapi github repos and it works wonderfully, however, I have a use-case where I require command line parser support to allow this to work without user interaction.
In other words, each of the interactive prompts should be implemented as an argument provided at the command line.
This will allow this marvellous utility to be used in a scripted environment.
Once it has a command line then it would be great to make this available as a Docker image rather than requiring node/npm/npx.
Please help!
sudo npm install -g generator-openapi-repo
[email protected] postinstall /usr/local/lib/node_modules/generator-openapi-repo/node_modules/jsonpath
node lib/aesprim.js > generated/aesprim-browser.js
sh: generated/aesprim-browser.js: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node lib/aesprim.js > generated/aesprim-browser.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/server/.npm/_logs/2018-01-11T08_47_17_808Z-debug.log
I have a created a folder that is "v1@messages" which has a post.cs file in it for the csharp code sample, but when I put the get.cs file in there and try to build it produces the following error:
throw Error('Code sample for non-existing operation: "' + path + '",' + verb);
If I move it out of there into it's own folder it produces the same error. I have tried with this folder name:
"v1@messages@{messageId}"
and
"v1@messages@messageId"
What else should I try? Also, this should be updated in the readme for code samples.
Hello,
I've used "yo" to generate the necessary files for travis ci integration and on first synchronization everything went fine but now I'm upgrading my swagger and the documentation is not getting updated although the travis build is running.
Going to the travis log I see this:
Cloning into '.'...
cp -Rn . ../web_deploy/
skipping existing file: index.html
skipping existing file: print.css
skipping existing file: reset.css
(...)
It skips every file that is already present in the branch and thus not updating the swagger.json and swagger.yaml.
Edit: Here's the build execution in case that helps: https://travis-ci.org/BeezUP/api-user_channelcatalogs/builds/226050290
Any help on what I'm doing wrong?
Thanks.
It has to do with \
vs. /
.
Unfortunatly the generator package is affected by the issue related to the "event-stream" incident. Are you already in preparations to fix this issue or shell try to make an pr?
Hi,
First of all - thank you for making this project - it saved a lot of efforts and time for me!
I have a question about the part of publishing assets to github pages - is there is a specific reason the workflow goes around so many steps?
I personally had some issues with the automatic deployment via travis and simplified this as following:
"gh-pages": "gh-pages -d dist"
, dist === web_deployThis way, the user has the possibility to deploy manually, without setting a token or forcing a https remote variant.
I'm just sharing some thoughts that might be simpler to implement this part, but if there's a specific reason to have the feature in other way, please close the issue directly :)
Again thanks for your work on this project!
Error in this line:
I think because the components
part is deleted too early:
create-openapi-repo/lib/split-definition.js
Lines 122 to 124 in c3f685d
Workaround:
"components": {
// Add this property to your json schema
"securitySchemes": {},
}
version: 2.0.0-rc.5
fixed by adding the file '/usr/local/lib/node_modules/create-openapi-repo/template/.gitignore'
Hi,
I got this message in travis log 'Deploy failed: Error: Unspecified error (run without silent option for detail)', any idea?
That was dropped too?
Thanks.
Following the instructions, I ran the commands:
[root@laptop1 swagger-spec]# npm install -g yo
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/lib/cli.js
/usr/local/bin/yo-complete -> /usr/local/lib/node_modules/yo/lib/completion/index.js
> [email protected] postinstall /usr/local/lib/node_modules/yo/node_modules/spawn-sync
> node postinstall
> [email protected] postinstall /usr/local/lib/node_modules/yo
10005 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/currently-unhandled
10006 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/decamelize
10007 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/decode-uri-component
10008 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/deep-extend
10009 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/deep-is
10010 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/delayed-stream
10011 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/combined-stream
10012 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/depd
10013 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/deref
10014 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/destroy
10015 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/detect-conflict
10016 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/detect-newline/node_modules/minimist
10017 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/diff
10018 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/dir-glob/node_modules/pify
10019 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/dir-glob/node_modules/path-type
10020 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/dir-glob
10021 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/dom-serializer/node_modules/domelementtype
10022 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/domelementtype
10023 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/domhandler
10024 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/domutils
10025 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/drange
10026 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/duplexer3
10027 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/ebnf-parser
10028 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/editions
10029 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/ee-first
10030 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/ejs
10031 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/encodeurl
10032 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/entities
10033 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/dom-serializer
10034 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/escape-html
10035 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/escape-string-regexp
10036 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/escodegen/node_modules/esprima
10037 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/esprima
10038 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/estraverse
10039 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/esutils
10040 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/etag
10041 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/exit-hook
10042 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/express/node_modules/iconv-lite
10043 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/express/node_modules/qs
10044 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/express/node_modules/raw-body/node_modules/depd
10045 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/express/node_modules/raw-body/node_modules/setprototypeof
10046 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/express/node_modules/statuses
10047 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/extend
10048 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/faker
10049 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/fast-levenshtein
10050 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/finalhandler/node_modules/statuses
10051 silly finalize /usr/local/lib/node_modules/generator-openapi-repo/node_modules/for-in
...skipping...
> yodoctor
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
Everything looks all right!
+ [email protected]
added 538 packages in 95.907s
I used the --ignore-scripts
option as nomnom is deprecated and causes the jsonpath
module install to fail.
[root@laptop1 swagger-spec]# npm install --ignore-scripts -g generator-openapi-repo
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
+ [email protected]
added 647 packages in 105.491s
so now I should be able to generate the content, right?
[root@laptop1 ~]# yo openapi-repo
/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
at Configstore.get (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:34:26)
at Configstore.get (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:81:13)
at Insight.get (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:48:22)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:197:47)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
wrong...
I don't know what permissions problem is supposed to be as I'm running the command as root and the file has open permissions for root and I can access the file
[root@laptop1 ~]# ll /root/.config/configstore/insight-yo.json
-rw------- 1 root root 30 May 29 17:26 /root/.config/configstore/insight-yo.json
[root@laptop1 ~]# ll /usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js
-rw-r--r-- 1 root root 2666 Dec 9 2015 /usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js
[root@laptop1 ~]# whoami
root
[root@laptop1 ~]# cat /root/.config/configstore/insight-yo.json
{
"clientId": 1330252673930
}
I had a play with v3.0.3 and it appears OpenAPI v2 is not supported at the moment. If this is incorrect, any guidance on how to use this for OpenAPI v2 would be much appreciated.
I understand previously versions did support OpenAPI v2. Digging through the history it appears this npm packages used be to called generator-openapi-repo
. What is the latest version of this tool which still supports OpenAPI v2?
Hello guys
i have been looking for a utility like that one for a few weeks now .. i followed the instructions to the best i could but after many tries , i always come down with this error at the build process
Not so sure if it's a bug or something wrong i'm doing but any help will be appreciated
here's the log from the Travis build
Computing checksum with sha256sum
Checksums matched!
Now using node v7.9.0 (npm v4.2.0)
travis_time:end:15af49d8:start=1492564024861290434,finish=1492564028362466982,duration=3501176548
�[0Ktravis_fold:end:nvm.install
�[0K$ node --version
v7.9.0
$ npm --version
4.2.0
$ nvm --version
0.33.1
travis_fold:start:install
�[0Ktravis_time:start:05dec4d8
�[0K$ npm install
�[37;40mnpm�[0m �[0m�[30;43mWARN�[0m �[0m�[35mdeprecated�[0m [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
�[0m�[37;40mnpm�[0m �[0m�[30;43mWARN�[0m �[0m�[35mdeprecated�[0m [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
�[0m�[37;40mnpm�[0m �[0m�[30;43mWARN�[0m �[0m�[35mdeprecated�[0m [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
�[0m�[37;40mnpm�[0m �[0m�[30;43mWARN�[0m �[0m�[35mprefer global�[0m [email protected] should be installed with -g
�[0m
[email protected] postinstall /home/travis/build/godloth/Test-doc/node_modules/jsonpath
node lib/aesprim.js > generated/aesprim-browser.js
[email protected] /home/travis/build/godloth/Test-doc
travis_time:end:05dec4d8:start=1492564029459106206,finish=1492564055571356505,duration=26112250299
�[0Ktravis_fold:end:install
�[0Ktravis_time:start:0cdb816b
�[0K$ npm test
[email protected] test /home/travis/build/godloth/Test-doc
swagger-repo validate
Adding paths to spec
/home/travis/build/godloth/Test-doc/node_modules/swagger-repo/lib/index.js:121
throw Error('All paths should be defined inside ' + pathsDir);
^
Error: All paths should be defined inside spec/paths/
at Object.exports.bundle (/home/travis/build/godloth/Test-doc/node_modules/swagger-repo/lib/index.js:121:13)
at Command. (/home/travis/build/godloth/Test-doc/node_modules/swagger-repo/bin/swagger-repo.js:41:23)
at Command.listener (/home/travis/build/godloth/Test-doc/node_modules/commander/index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:194:7)
at Command.parseArgs (/home/travis/build/godloth/Test-doc/node_modules/commander/index.js:615:12)
at Command.parse (/home/travis/build/godloth/Test-doc/node_modules/commander/index.js:458:21)
at Object. (/home/travis/build/godloth/Test-doc/node_modules/swagger-repo/bin/swagger-repo.js:85:4)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
�[37;40mnpm�[0m �[0m�[31;40mERR!�[0m�[35m�[0m Test failed. See above for more details.
�[0m
travis_time:end:0cdb816b:start=1492564055576742665,finish=1492564057024598145,duration=1447855480
�[0K
�[31;1mThe command "npm test" exited with 1.�[0m
Done. Your build exited with 1.`
I got ReDoc-ly working with CircleCI, but it was kind of an adventure. Thought I'd share here in case someone wants to add support in the future.
I was not able to get authentication working with a personal token on a GitHub Organization. I found documentation indicating this is not supported. Changed to use ssl (which is nicely supported by CircleCI)
Needed to work around config of gh-pages. Mainly for the ssl auth. (Token Auth is hardcoded)
Added deploy
:
{
"name": "velo-payments-openapi",
"version": "1.0.0",
"dependencies": {
"swagger-repo": "^2.0.0-rc.11"
},
"private": true,
"scripts": {
"start": "swagger-repo serve",
"build": "swagger-repo build -o web_deploy",
"test": "swagger-repo validate",
"gh-pages": "swagger-repo gh-pages",
"deploy": "gh-pages -a -m 'Deployed to Github Pages' -d 'web_deploy' -u 'CircleCI <[email protected]>' "
}
}
CIrcleCI Build Configuration
$CIRCLE_BANCH
- is a standard environment variable in the CircleCI build environment.version: 2.1
jobs:
build:
docker:
- image: circleci/node:11.9.0
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: 'sudo npm install -g npm@latest'
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Deploy to gh-pages
command: |
GIT_REPO="[email protected]:<YOUR REPO HERE>"
rm -rf ./node_modules/gh-pages/.cache
if [ $CIRCLE_BRANCH == "master" ]
then
echo "Running on Master"
npm run build
echo "Deploying"
npm run deploy -r $GIT_REPO
elif [ $CIRCLE_BRANCH != "master" ] && [ $CIRCLE_BRANCH != "gh-pages" ]
then
echo "Running NOT on master or gh-pages"
npm run build
DEST_DIR="/branch/$CIRCLE_BRANCH"
echo "Deploying to branch $DEST_DIR on $GIT_REPO"
npm run deploy -- "-r $GIT_REPO --dest $DEST_DIR"
else
echo Should not get here
fi
workflows:
version: 2
build-deploy:
jobs:
- build:
filters:
branches:
ignore:
- gh-pages
When generating my api repo I answered yes to whether swagger ui should be installed.
But when running npm start localhost:8080/swagger-ui/
returns a 404
. Same when deploying to gh-pages.
? Do you already have OpenAPI/Swagger spec for your API? No
? Your API name (without API) Yoda
? Specify name of GitHub repo in format User/Repo: monolithed/test
? Split spec into separate files: paths/*, definitions/* [Experimental]? Yes
? Prepare code samples Yes
? Install SwaggerUI Yes
create package.json
identical .gitignore
create LICENSE
create README.md
identical .travis.yml
create gulpfile.js
create scripts/build.js
create scripts/deploy-branch.js
create web/index.html
create spec/README.md
create spec/paths/README.md
create spec/definitions/README.md
create spec/code_samples/README.md
➜ npm start
> [email protected] start /Users/a.abashkin/workspace/mail.ru/@qa/test-doc
> gulp serve
[18:24:03] Using gulpfile ~/workspace/mail.ru/@qa/test-doc/gulpfile.js
[18:24:03] Starting 'build'...
[18:24:03] Starting 'watch'...
[18:24:03] Finished 'watch' after 20 ms
[18:24:03] Starting 'edit'...
[18:24:03] Finished 'edit' after 2.61 ms
[18:24:03] swagger-editor started http://localhost:5000
/doc/node_modules/swagger-repo/lib/index.js:121
throw Error('All paths should be defined inside ' + pathsDir);
^
Error: All paths should be defined inside spec/paths/
at Object.exports.bundle (/doc/node_modules/swagger-repo/lib/index.js:121:13)
at Command.<anonymous> (/doc/node_modules/swagger-repo/bin/swagger-repo.js:18:23)
at Command.listener (/doc/node_modules/commander/index.js:300:8)
at emitTwo (events.js:125:13)
at Command.emit (events.js:213:7)
at Command.parseArgs (/doc/node_modules/commander/index.js:635:12)
at Command.parse (/doc/node_modules/commander/index.js:457:21)
at Object.<anonymous> (/doc/node_modules/swagger-repo/bin/swagger-repo.js:85:4)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] swagger: `swagger-repo "bundle" "-o" "web_deploy/swagger.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] swagger script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/a.abashkin/.npm/_logs/2017-10-19T15_24_05_820Z-debug.log
/doc/node_modules/shelljs/src/common.js:417
if (config.fatal) throw e;
^
Error: exec: internal error
at Object.error (/doc/node_modules/shelljs/src/common.js:128:27)
at _exec (/doc/node_modules/shelljs/src/exec.js:292:12)
at /doc/node_modules/shelljs/src/common.js:350:23
at Object.<anonymous> (/doc/scripts/build.js:12:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node ./scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/a.abashkin/.npm/_logs/2017-10-19T15_24_05_865Z-debug.log
[18:24:05] 'build' errored after 2.35 s
[18:24:05] Error: Command failed: npm run build
/doc/node_modules/swagger-repo/lib/index.js:121
throw Error('All paths should be defined inside ' + pathsDir);
^
Error: All paths should be defined inside spec/paths/
at Object.exports.bundle (/doc/node_modules/swagger-repo/lib/index.js:121:13)
at Command.<anonymous> (/doc/node_modules/swagger-repo/bin/swagger-repo.js:18:23)
at Command.listener (/doc/node_modules/commander/index.js:300:8)
at emitTwo (events.js:125:13)
at Command.emit (events.js:213:7)
at Command.parseArgs (/doc/node_modules/commander/index.js:635:12)
at Command.parse (/doc/node_modules/commander/index.js:457:21)
at Object.<anonymous> (/doc/node_modules/swagger-repo/bin/swagger-repo.js:85:4)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] swagger: `swagger-repo "bundle" "-o" "web_deploy/swagger.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] swagger script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/a.abashkin/.npm/_logs/2017-10-19T15_24_05_820Z-debug.log
/doc/node_modules/shelljs/src/common.js:417
if (config.fatal) throw e;
^
Error: exec: internal error
at Object.error (/doc/node_modules/shelljs/src/common.js:128:27)
at _exec (/doc/node_modules/shelljs/src/exec.js:292:12)
at /doc/node_modules/shelljs/src/common.js:350:23
at Object.<anonymous> (/doc/scripts/build.js:12:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node ./scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/a.abashkin/.npm/_logs/2017-10-19T15_24_05_865Z-debug.log
at ChildProcess.exithandler (child_process.js:271:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Socket.stream.socket.on (internal/child_process.js:348:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:547:12)
Adding paths to spec
Error: All paths should be defined inside spec/paths/
at Object.exports.bundle (/doc/node_modules/swagger-repo/lib/index.js:121:13)
at /doc/node_modules/swagger-repo/lib/index.js:35:27
at Layer.handle [as handle_request] (/doc/node_modules/express/lib/router/layer.js:95:5)
at next (/doc/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/doc/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/doc/node_modules/express/lib/router/layer.js:95:5)
at /doc/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/doc/node_modules/express/lib/router/index.js:335:12)
at next (/doc/node_modules/express/lib/router/index.js:275:10)
at SendStream.error (/doc/node_modules/express/node_modules/serve-static/index.js:121:7)
Adding paths to spec
Error: All paths should be defined inside spec/paths/
at Object.exports.bundle (/doc/node_modules/swagger-repo/lib/index.js:121:13)
at /doc/node_modules/swagger-repo/lib/index.js:35:27
at Layer.handle [as handle_request] (/doc/node_modules/express/lib/router/layer.js:95:5)
at next (/doc/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/doc/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/doc/node_modules/express/lib/router/layer.js:95:5)
at /doc/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/doc/node_modules/express/lib/router/index.js:335:12)
at next (/doc/node_modules/express/lib/router/index.js:275:10)
at SendStream.error (/doc/node_modules/express/node_modules/serve-static/index.js:121:7)
^C
Running npx create-openapi-repo
and then 'npm start', I get the following errors in console and nothing appears in the browser.
Do I need to add any additional files before I run 'npm start' for this to work?
react-dom.production.min.js:196 Error: An error occurred. See https://github.com/styled-components/polished/blob/master/src/internalHelpers/errors.md#3 for more information.
at T (polished.es.js:1810)
at j (polished.es.js:1988)
at Y (polished.es.js:2278)
at polished.es.js:2127
at linesColor (theme.ts:118)
at Object.get [as linesColor] (theme.ts:226)
at JSON.stringify (<anonymous>)
at new e (theme.ts:241)
at t.render (RedocStandalone.tsx:42)
at Za (react-dom.production.min.js:181)
gs @ react-dom.production.min.js:196
n.callback @ react-dom.production.min.js:210
Oi @ react-dom.production.min.js:131
Ei @ react-dom.production.min.js:131
Ll @ react-dom.production.min.js:252
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:120
Nl @ react-dom.production.min.js:244
xl @ react-dom.production.min.js:223
gl @ react-dom.production.min.js:214
oc @ react-dom.production.min.js:279
(anonymous) @ react-dom.production.min.js:282
El @ react-dom.production.min.js:224
uc @ react-dom.production.min.js:282
render @ react-dom.production.min.js:286
cu @ standalone.tsx:49
(anonymous) @ (index):33
construct.js:30 Uncaught Error: An error occurred. See https://github.com/styled-components/polished/blob/master/src/internalHelpers/errors.md#3 for more information.
at T (polished.es.js:1810)
at j (polished.es.js:1988)
at Y (polished.es.js:2278)
at polished.es.js:2127
at linesColor (theme.ts:118)
at Object.get [as linesColor] (theme.ts:226)
at JSON.stringify (<anonymous>)
at new e (theme.ts:241)
at t.render (RedocStandalone.tsx:42)
It would be useful to have a possibility to host more than one specs which can share definitions.
Ideas:
What problems it solves:
Some implementation details:
"Write it using your favorite text-editor or IDE (we love VSCode)."
Which plugin do you use when editing an openAPI repo? For large project and multiple contributions, externalizing the markdown makes a lot of sense.
I'm currently using the OpenAPI (Swagger) Editor (42crunch.vscode-openapi) with the Redoc rendering setting. This crashes when adding references to external markdown files.
Do you have any preferred workflow and toolset that doesn't involve a lot of copy/pasting and commenting out the API definition while working with the openapi-repo structure?
Simple list of links in preview/index.html
Hi again,
I can't find the 'try it button' in my swagger-ui. I have created a new project from scratch and the button is not shown also.
Thank you in advanced.
I am trying to generate code samples and I am getting the following message:
Adding code samples to spec
Running plugins
Plugins folder not found. Skip.
Would be great if someone could explain where to find the plugins and how to add them?
Thanks!
Hi all,
Just migrated to v3. I quite liked having the swagger bits too, any tips on how to add them back?
Thanks.
I tried using https://swagger.io/blog/api-development/generator-openapi-repo/ for generating Swagger docs and host them on GitHub, but getting a 404 for my apis specs:
Here is the API link
Documentation(ReDoc): https://jaynarathod.github.io/spring-boot-docs/
SwaggerUI: https://jaynarathod.github.io/spring-boot-docs/swagger-ui/
I am just starting with this repo, I did everything according to the docs however when I finish the last step and get the following:
Success! Created openapi folder.
You can run several commands:
npm start
Starts the development server.
npm run build
Bundles the definition.
npm test
Validates the definition.
We suggest that you begin by typing:
npm start
I try to use npm start and i get the below:
(node:29112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): YAMLException: unknown escape sequence at line 3, column 18:
main: "openapi\openapi.yaml"
^
(node:29112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can you help please?
What version and what is the release cycle between this repo and redoc
? I noticed there's no support for callbacks if I try to run a specification in this repo.
ReDoc doesn't seem to support OpenAPI 3.0
Tried generating a new spec using create-openapi-repo .
and even though there are code samples generated they do not appear in the rendered document
Hi all,
If I run npm build
I get:
~/src/SureVoIP-API-Specification [master*]$ npm build
~/src/SureVoIP-API-Specification [master*]$ ls
LICENSE node_modules package.json package-lock.json README.md redocly.yaml spec web
if I do it by hand it works:
~/src/SureVoIP-API-Specification [master*]$ node_modules/swagger-repo/bin/swagger-repo.js build -o web_deploy
[spec] Adding paths
[spec] Adding components/schemas to spec
[spec] Adding components/responses to spec
[spec] Adding components/headers to spec
[spec] Adding components/securitySchemes to spec
[spec] Adding code samples
Copied /web to web_deploy
Copied Swagger UI to web_deploy/swagger-ui
Created web_deploy/openapi.json
Created web_deploy/openapi.yaml
Created web_deploy/index.html
Any ideas what's going on?
Thanks.
Possibly using this project:
https://github.com/zallek/swagger-diff
Probable should contain:
latest
with worning about breaking changesAnyone else getting this error?
I'm using:
node -v: v7.7.3
npm -v: 4.2.0
and getting the following error:
yo openapi-repo
_-----_
| | ╭──────────────────────────╮
|--(o)--| │ Welcome to the │
---------´ │ OpenAPI-Repo generator! │ ( _´U
_ ) ╰──────────────────────────╯
/A\ /
| ~ |
'..'_
´ |° ´ Y
? Do you already have OpenAPI/Swagger spec for your API? (y/N)
events.js:163
throw er; // Unhandled 'error' event
^
TypeError: this.env.adapter.prompt(...).then is not a function
at child.Base.prompt (/opt/local/lib/node_modules/generator-openapi-
repo/node_modules/yeoman-generator/lib/base.js:240:45)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.