Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

Conversation

@ahlagever
Copy link

This PR fixes the service loader initializations for SwaggerParserExtension so that the correct class loader is used, regardless of the thread's context class loader.

This essentially fixes an issue that occurs when calling OpenAPIParser.readLocation (and subsequently OpenAPIParser.getExtensions) from a thread that doesn't use the same class loader which is used to load swagger-parser module (e.g. build tool plugins), and as a result, the parser is incapable of parsing OpenAPI 2.0 specs.

Related: OpenAPITools/openapi-generator#2658

@jmini
Copy link
Member

jmini commented Apr 15, 2019

Thank you for this patch. It looks good to me.


For the moment we maintain this fork and use it in OpenAPITools/openapi-generator because some patches were not added to the upstream project: swagger-api/swagger-parser

But ideally it should stay a temporary solution, and we would like to avoid divergence between the two projects.

Can you submit the same patch against swagger-api/swagger-parser (for their master branch)?

Please let me know if you need help or if you have any question.

@jmini
Copy link
Member

jmini commented Apr 15, 2019

It seems that the upstream project track this as issue swagger-api#1003 and has proposed a fix with swagger-api#1068

@adigerber: Can you review that the change that was made on OpenAPIV3Parser is working for you?

As far as I can tell, the change does not cover OpenAPIParser as you do in this PR.

Can you update your PR accordingly?
Tell me if you need help...

@jmini
Copy link
Member

jmini commented Apr 30, 2019

Now that PR swagger-api#1085 has been merged in the upstream project (in addition to PR swagger-api#1068), I think that this PR is no longer necessary.

Please reopen if you disagree.

@jmini jmini closed this Apr 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants