Null ptr exception on `parametersIntersect`
Dogacel opened this issue · 1 comments
Dogacel commented
Unexpected exception. Reason: null
java.lang.NullPointerException
at org.openapitools.openapidiff.core.compare.PathsDiff.lambda$parametersIntersect$4(PathsDiff.java:138)
at java.util.stream.IntPipeline$9$1.accept(IntPipeline.java:366)
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.LongPipeline.reduce(LongPipeline.java:461)
at java.util.stream.LongPipeline.sum(LongPipeline.java:419)
at java.util.stream.IntPipeline.count(IntPipeline.java:452)
at org.openapitools.openapidiff.core.compare.PathsDiff.parametersIntersect(PathsDiff.java:139)
at org.openapitools.openapidiff.core.compare.PathsDiff.methodsAndParametersIntersect(PathsDiff.java:119)
at org.openapitools.openapidiff.core.compare.PathsDiff.lambda$null$1(PathsDiff.java:56)
at java.util.function.BinaryOperator.lambda$minBy$0(BinaryOperator.java:59)
at java.util.stream.ReduceOps$2ReducingSink.accept(ReduceOps.java:123)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:546)
at java.util.stream.ReferencePipeline.min(ReferencePipeline.java:587)
at org.openapitools.openapidiff.core.compare.PathsDiff.lambda$diff$3(PathsDiff.java:54)
at java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559)
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't share the schemas I used to compare. But I can say our spec is poorly documented & it might miss parameter definitions. We use https://github.com/iheartradio/play-swagger to generate our swagger specs.
Dogacel commented
I was able to resolve this by doing two things:
- Change
swagger: "2.0"
toopenapi: 3.0.0
- Remove some hard-coded fields that made my schema openapi 3.0.0 compatible.
I hope this issue can guide others.