@Test
public void loadMinimalExample() {
SwaggerParseResult parseResult = new OpenAPIV3Parser().readWithInfo("callback-param-api.yaml", emptyList());
List<String> msgs = parseResult.getMessages();
if (!msgs.isEmpty()) {
fail(Joiner.on("\n").join(msgs));
}
}
produces the warning components.callbacks(post).parameters. There are duplicate parameter values. The problem vanishes if you use only one parameter reference.
Background / Assumptions
This is closely related to the work done in #1063 #1066 #1065 #1080. From my understanding, the issue unfolds like this: OpenAPIDeserializer first deserializes components (which includes parameters and callbacks), then paths. To validate parameters, the getParameterDefinition method is used to resolve parameter references from this.components. This works fine when paths reference stuff, but when callbacks are parsed, this.coomponents does not exist yet. Since the resolving fails, the two callback parameter are then regarded to be identical. I could be completely wrong though :)
Hi, using io.swagger.parser.v3:swagger-parser:jar:2.1.22, this spec:
fails to parse properly. This code
produces the warning
components.callbacks(post).parameters. There are duplicate parameter values
. The problem vanishes if you use only one parameter reference.Background / Assumptions This is closely related to the work done in #1063 #1066 #1065 #1080. From my understanding, the issue unfolds like this:
OpenAPIDeserializer
first deserializescomponents
(which includesparameters
andcallbacks
), thenpaths
. To validate parameters, thegetParameterDefinition
method is used to resolve parameter references fromthis.components
. This works fine whenpaths
reference stuff, but when callbacks are parsed,this.coomponents
does not exist yet. Since the resolving fails, the two callback parameter are then regarded to be identical. I could be completely wrong though :)