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

need help for using editor in Reactv18 app: schema with key or id "openapi-2.0" already exists. #5331

Closed
aioriachen opened this issue Dec 31, 2024 · 0 comments

Comments

@aioriachen
Copy link

Q&A (please complete the following information)

  • OS: [windows 11]
  • Browser: [Edge]
  • Version: [132.0.2957.55]
  • Method of installation: [npm]
  • Swagger-Editor version: [4.14.1]
  • Swagger/OpenAPI version: [Swagger 2.0]

Content & configuration

Swagger/OpenAPI definition:
only json data in memory.
{
swagger: "2.0",
info: {
title: "Sample API",
version: "1.0",
description: "Sample API for testing purposes"
},
paths: {
"/api/test": {
get: {
description: "Test GET endpoint",
responses: {
200: {
description: "Request was successful"
}
}
}

Swagger-Editor configuration options:

SwaggerEditor({
  dom_id: '#swagger-editor',
        spec: defaultApiDefinition,
        onComplete: () => {
          console.log('Editor instance initialized');
        },
        onError: (error) => {
          console.error('Error during Swagger Editor initialization:', error);
        }
})
?yourQueryStringConfig

Screenshots

image

How can we help?

you can see the code in the attached file.
when first open the swagger editor, it's ok. but when go back to the json view, and switch to the editor again, the error is shown.
what should i do to fix that, all what is the best way to use editor in react app.(not only with swagger UI.)
app.js.md

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

1 participant