swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Worker caught an error: Error: schema with key or id "openapi-2.0" already exists

Open adilorenzodema opened this issue 3 years ago • 2 comments

Content & configuration

Swagger/OpenAPI definition: I use two valid Yaml files. If you want I can insert it.

Is your feature request related to a problem?

Yes, it is related to https://github.com/swagger-api/swagger-editor/issues/2339

image

Describe the solution you'd like

It's possible create a clean SwaggerEditorBundle instance function, in order to call it on 'ngOnDestroy' angular function?

adilorenzodema avatar Apr 13 '22 12:04 adilorenzodema

Yes , thanks for creating this, hope for a quicker solution

rijuvf avatar Apr 14 '22 09:04 rijuvf

i got the same error how can i fix this?

NetanelCohenDev avatar Sep 13 '22 10:09 NetanelCohenDev

Yes if author add this in their code, we can control worker and finish him in unmount steps @char0n

image

MrKarlsonCloud avatar Oct 14 '22 14:10 MrKarlsonCloud

I've issued a following PR that exposes worker life-cycle management to the plugin system via getWorker and terminateWorker redux thunks. Example of using this:

// instantiation
const editor = SwaggerEditorBundle({
  dom_id: '#swagger-editor',
  layout: 'StandaloneLayout',
  presets: [
    SwaggerEditorStandalonePreset
  ],
  queryConfigEnabled: true,
});

// after the SwaggerEditor have been disposed of, terminate the worker manually
editor.jsonSchemaValidatorActions.terminateWorker();

Awaiting feedback, if this is sufficient solution for this issue.

char0n avatar Oct 21 '22 09:10 char0n

It will be perfect @char0n thank you :D

MrKarlsonCloud avatar Oct 21 '22 10:10 MrKarlsonCloud

is it resolve in new version v4.4.4 release?

Dilo07 avatar Oct 21 '22 10:10 Dilo07

@Dilo07 no, I've issued this PR an hour ago and I'm currently awaiting feedback. Will merge (if I have some feedback that this will help resolve the issue) and release during Monday.

char0n avatar Oct 21 '22 10:10 char0n

ok, I'm waiting for you to test the fix release.

Dilo07 avatar Oct 21 '22 11:10 Dilo07

The change described in https://github.com/swagger-api/swagger-editor/issues/3016#issuecomment-1286716347 released in v4.5.0.

char0n avatar Oct 24 '22 09:10 char0n

@char0n Thank you guys :)

MrKarlsonCloud avatar Oct 24 '22 10:10 MrKarlsonCloud

Now it's fine, thanks!

Dilo07 avatar Oct 24 '22 10:10 Dilo07