redskap / swagger-brake

Swagger contract checker for breaking API changes
Apache License 2.0
59 stars 15 forks source link

NullPointException when comparing to pretty similar specs #137

Open pkunze opened 2 weeks ago

pkunze commented 2 weeks ago

We are running into a null reference exception when comparing two pretty similar specs:

Logs

Loading old API from current_release_approved.json
Loading new API from swagger_hot.json
Successfully loaded APIs
Starting the check for breaking API changes
Exception occured
java.lang.NullPointerException: null
    at java.base/java.util.Objects.requireNonNull(Objects.java:208)
    at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
    at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.TreeMap$KeySpliterator.forEachRemaining(TreeMap.java:3064)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at io.redskap.swagger.brake.core.model.Schema.internalGetTypes(Schema.java:86)
    at io.redskap.swagger.brake.core.model.Schema.getTypes(Schema.java:77)
    at io.redskap.swagger.brake.core.rule.response.ResponseTypeChangedRule.checkRule(ResponseTypeChangedRule.java:39)
    at io.redskap.swagger.brake.core.DefaultBreakecker.lambda$check$1(DefaultBreakChecker.java:31)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at io.redskap.swagger.brake.core.DefaultBreakChecker.check(DefaultBreakChecker.java:31)
    at io.redskap.swagger.brake.runner.Checker.check(Checker.java:32)
    at io.redskap.swagger.brake.runner.Runner.run(Runner.java:52)
    at io.redskap.swagger.brake.runner.Starter.start(Starter.java:15)
    at io.redskap.swagger.brake.cli.Cli.start(Cli.java:34)
    at io.redskap.swagger.brake.cli.SwaggerBrakeMain.main(SwaggerBrakeMain.java:16)
For help please use --help
script returned exit code 2

I can provide the two specs that cause the error via mail. Unfortunately, i cannot share them publicly here.

You don't seem to have sponsoring turned on or a coffe link, but i would gladly tip you one or another beer since we really enjoy your work!

galovics commented 2 weeks ago

hi @pkunze,

If it's possible, you can share them with me via email as well (arnold_galovics(at)docktape(dot).com) and I can strip it down to a point where it could be used for the automated tests in the project.

On the coffee, thanks for the nice words, I'll look it into. :-)

pkunze commented 1 day ago

I somehow missed your comment. Sorry for my late response. I will send them to you on monday. :)