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

I can't get this to work, got error #18

Closed
dietergeerts opened this issue Jan 10, 2023 · 3 comments
Closed

I can't get this to work, got error #18

dietergeerts opened this issue Jan 10, 2023 · 3 comments

Comments

@dietergeerts
Copy link

dietergeerts commented Jan 10, 2023

While evaluating tools for our API documentation and creation process, I tried this with our current swagger file, and can't get the serve to work. Then I tried with the official "pet store" spec, and that doesn't work either. I got the following error:

image

I was hoping to get this to work easily, but that doesn't seem to be the case, so I'm very hesitant to dive deeper into this tool(s) in order to see if we can use them. The thing is that a lot of peer dependencies are wrong, or are not correctly used, and with our rush/pnpm setup, they are checked, and thus I had to add lots of exclusions to install this package to begin with, which doesn't seem good Imho.

Another strange thing is that redoc doesn't support OpenAPI 3.1 yet, and is used here, while this project claims this support?

Some help is appreciated to further validate the usage of this tool.

@gigaga
Copy link
Contributor

gigaga commented Jan 10, 2023

Hi @dietergeerts ,

I tried to serve the official "pet store" spec from https://petstore.swagger.io/v2/swagger.json without any issue.

To analyze your issue, I need you provide:

  1. Your openapi specs file
  2. Your openapi-dev-tool config file
  3. The version of openapi-dev-tool used

About OpenAPI 3.1 support, I confirm you that Redoc support OpenAPI 3.1 (basic) cf. https://github.com/Redocly/redoc

Regards,

@dietergeerts
Copy link
Author

  1. Your openapi specs file

I used the petstore one, both v2 and v3, to make sure the setup works first before trying our own.

  1. Your openapi-dev-tool config file
{
    "specs": [
        {
            "file": "./petstore.json",
            "context": {
                "version": "2.0",
                "public": "true"
            }
        }
    ]
}
  1. The version of openapi-dev-tool used

9.7.3

But like mentioned I had to remove several peer dependencies due to errors when installing with pnpm. Now this file just removes the listing from the package file, so we don't get the errors, but they do point out that there is something wrong with the setup, and that the used packages are incompatible, and maybe in one of these is the reason of this bug?

module.exports = {
    hooks: {
        readPackage(pkg, context) {
            if (pkg.name === 'ajv-oai') {
                context.log('Remove peer on ajv from ajv-oai');
                delete pkg.peerDependencies['ajv'];
            }
            if (pkg.name === 'mobx-react-lite') {
                context.log('Remove peer on mobx from mobx-react-lite');
                delete pkg.peerDependencies['mobx'];
            }
            if (pkg.name === 'mobx-react') {
                context.log('Remove peer on mobx from mobx-react');
                delete pkg.peerDependencies['mobx'];
            }
            if (pkg.name === 'redoc') {
                context.log('Remove peer on core-js from redoc');
                delete pkg.peerDependencies['core-js'];
                context.log('Remove peer on mobx from redoc');
                delete pkg.peerDependencies['mobx'];
                context.log('Remove peer on styled-components from redoc');
                delete pkg.peerDependencies['styled-components'];
            }
            return pkg;
        }
    }
}

@gigaga
Copy link
Contributor

gigaga commented Jan 13, 2023

Hi @dietergeerts ,

Thanks for your feedback. I tried to reproduce your issue by using your configuration file, but I can't do it. All works like a charm ;)

I think your main problem is that you removed some peer dependencies... When you install openapi-dev-tool by using, for example, npm i -g @lyra-network/openapi-dev-tool, there are several conflict messages, even if it is not great or beautiful, you shouldn't remove dependencies after installing. It is not blocking. Also, can you force conflict resolution by using --force parameter : npm i -g @lyra-network/openapi-dev-tool --force

This warning messages are due to another dependencies:

Without these, I had to find some workarounds...

Regards,

@gigaga gigaga closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants