Open slorenzbmw opened 1 year ago
@slorenzbmw Thanks for reporting this!
I'm unable to reproduce your issue with a simple test:
--- core/src/test/resources/issue-495_1.yaml 2020-06-23 08:24:12
+++ core/src/test/resources/issue-495_2.yaml 2023-03-22 21:32:47
@@ -37,7 +37,7 @@
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- - name: status
+ - name: Status
in: query
description: Status values that need to be considered for filter
required: true
Could you please provide a minimal example to reproduce the issue?
Thanks for looking into this! What i missed in my inital comment is that also a letter was added, but i could reproduce it both by changing the lettercase and removing / adding a letter to a parameter i tested it on:
and could reproduce it with this minimum set: old
{
"swagger": "2.0",
"info": {
"title": "***",
"version": "v1"
},
"host": "***",
"basePath": "***",
"schemes": [
"https"
],
"paths": {
"/test": {
"get": {
"description": "***",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "online",
"description": "***",
"required": false,
"in": "query",
"type": "string"
}
]
}
}
}
}
new
{
"swagger": "2.0",
"info": {
"title": "***",
"version": "v1"
},
"host": "***",
"basePath": "***",
"schemes": [
"https"
],
"paths": {
"/test": {
"get": {
"description": "***",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "oneLine",
"description": "***",
"required": false,
"in": "query",
"type": "string"
}
]
}
}
}
}
Any change on the parameter "name" results in a java.lang.NullPointerException for me
If i try to diff two files where only the following is different, i get the following error
Compare 1:
{ "name": "oneLine", "description": "***", "required": false, "in": "query", "type": "string" },
Compare 2:{ "name": "online", "description": "***", "required": false, "in": "query", "type": "string" },
=> see the difference in "l" and "L" in the parameter "name"Error:
Unexpected exception. Reason: Cannot invoke "String.isEmpty()" because "newParameterName" is null java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "newParameterName" is null at org.openapitools.openapidiff.core.compare.ParametersDiff.pathUnchangedParametersChanged(ParametersDiff.java:102) at org.openapitools.openapidiff.core.compare.ParametersDiff.diff(ParametersDiff.java:88) at org.openapitools.openapidiff.core.compare.OperationDiff.diff(OperationDiff.java:78) at org.openapitools.openapidiff.core.compare.PathDiff.diff(PathDiff.java:39) at org.openapitools.openapidiff.core.compare.PathsDiff.lambda$diff$3(PathsDiff.java:90) at java.base/java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:589) at org.openapitools.openapidiff.core.compare.PathsDiff.diff(PathsDiff.java:47) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:96) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:64) at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:102) at org.openapitools.openapidiff.core.OpenApiCompare.fromLocations(OpenApiCompare.java:91) at org.openapitools.openapidiff.cli.Main.main(Main.java:175)
I can trace it back to here: https://github.com/OpenAPITools/openapi-diff/blob/d6383f3a70423c7abbcdb5b50a05619c9ea6fba7/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java#L102