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

OpenAPIDeserializer produces NPE when a path references an undeclared path parameter #1402

Closed
ghost opened this issue Jul 16, 2020 · 2 comments · Fixed by #1403
Closed

OpenAPIDeserializer produces NPE when a path references an undeclared path parameter #1402

ghost opened this issue Jul 16, 2020 · 2 comments · Fixed by #1403

Comments

@ghost
Copy link

ghost commented Jul 16, 2020

The OpenAPIDeserializer runs into a NPE and, as a consequence, produces a diagnostic message with content "null", when a path references a path parameter that is not declared in the respective operation.

How to reproduce:

  1. Store this file as input.json

input.json.gz
.

  1. Store this file as ParseOpenAPI3File.java.

ParseOpenAPI3File.java.gz

Compile it with a classpath that contains
slf4j-api-1.5.8.jar
slf4j-jdk14-1.5.8.jar
jackson-core-2.11.0.jar
jackson-dataformat-yaml-2.11.0.jar
jackson-databind-2.11.0.jar
jackson-annotations-2.11.0.jar
jackson-datatype-jsr310-2.11.0.jar
commons-io-1.4.jar
commons-lang3-3.1.jar
swagger-models-2.1.3.jar
swagger-core-2.1.3.jar
swagger-parser-v3-2.0.20.jar
swagger-parser-core-2.0.20.jar
snakeyaml.jar

  1. Run it with one argument, namely the absolute file name from step 1.

Expected output:

Messages from OpenAPIV3Parser:
attribute paths.'/restTest/arraytypes/complexArrayEcho/{value}'. Declared path parameter value needs to be defined as a path parameter in path or operation level
attribute paths.'/restTest/arraytypes/complexArrayEcho/{value}'. Declared path parameter value needs to be defined as a path parameter in path or operation level

Actual output:

Messages from OpenAPIV3Parser:
null
@ghost
Copy link
Author

ghost commented Jul 16, 2020

The following patch fixes it:
1402-fix.diff.gz

@gracekarina
Copy link
Contributor

thanks @brhaible

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

Successfully merging a pull request may close this issue.

1 participant