Redocly / Redocly/create-openapi-repo

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

Open
#66 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
695
Forks
111
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the create-openapi-repo --migrate-2-3 entry point and inspect injectCodeSamples in lib/migrate-2-3.js around line 322, where the report shows the failure. Reproduce the migration with spec/code_samples/README.md present, then verify that the migration completes successfully without requiring that file to be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.