Redocly/create-openapi-repo

create-openapi-repo --migrate-2-3 (spec/code_samples/ needs to be empty)

ghenry opened this issue · 0 comments

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!