swagger-parser
swagger-parser copied to clipboard
when the same component used in two different places in two different apis then parser fails
Hi, I'm getting ClassCastException when the same parameter from $ref is used in different places in different APIs. In this PR I've added a test case for this problem.
Exception:
java.lang.ClassCastException: Cannot cast io.swagger.v3.oas.models.headers.Header to io.swagger.v3.oas.models.parameters.Parameter
at java.base/java.lang.Class.cast(Class.java:3816)
at io.swagger.v3.parser.ResolverCache.loadRef(ResolverCache.java:116)
at io.swagger.v3.parser.processors.ParameterProcessor.processParameters(ParameterProcessor.java:86)
at io.swagger.v3.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:39)
at io.swagger.v3.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:84)
at io.swagger.v3.parser.OpenAPIResolver.resolve(OpenAPIResolver.java:49)
at io.swagger.v3.parser.OpenAPIV3Parser.resolve(OpenAPIV3Parser.java:183)
at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:162)
at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:99)