cats icon indicating copy to clipboard operation
cats copied to clipboard

java.lang.NullPointerException when trying to parse a swagger v2.0 with custom extentions

Open vzhirnov opened this issue 3 years ago • 2 comments

cats --server=https://my_server --contract=swagger.json --headers=my_headers.yaml --paths=/v1/objects/hint/create --blackbox --debug

[][] 👣 trace Getting fields for prefix:
[
][] 👣 trace Getting fields for prefix: clientid java.lang.NullPointerException at com.endava.cats.model.FuzzingData.getFields(FuzzingData.java:94) at com.endava.cats.model.FuzzingData.getFields(FuzzingData.java:105) at com.endava.cats.model.FuzzingData.getAllFieldsAsCatsFields(FuzzingData.java:147) at com.endava.cats.model.FuzzingData.getAllReadOnlyFields(FuzzingData.java:126) at com.endava.cats.model.FuzzingData.removeReadWrite(FuzzingData.java:71) at com.endava.cats.model.FuzzingData.getPayload(FuzzingData.java:63) at com.endava.cats.command.CatsCommand.lambda$fuzzPath$6(CatsCommand.java:225) at java.util.ArrayList.forEach(ArrayList.java:1541) at com.endava.cats.command.CatsCommand.fuzzPath(CatsCommand.java:224) at com.endava.cats.command.CatsCommand.startFuzzing(CatsCommand.java:137) at com.endava.cats.command.CatsCommand.doLogic(CatsCommand.java:121) at com.endava.cats.command.CatsCommand.run(CatsCommand.java:108) at picocli.CommandLine.executeUserObject(CommandLine.java:1939) at picocli.CommandLine.access$1300(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) at picocli.CommandLine.execute(CommandLine.java:2078) at com.endava.cats.CatsMain.run(CatsMain.java:27) at com.endava.cats.CatsMain_ClientProxy.run(Unknown Source) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:124) at io.quarkus.runtime.Quarkus.run(Quarkus.java:67) at io.quarkus.runtime.Quarkus.run(Quarkus.java:41) at io.quarkus.runner.GeneratedMain.main(Unknown Source)

Presumably, CATS does not know how to work with ^x- custom extensions, could you please check this case?

vzhirnov avatar Jul 18 '22 06:07 vzhirnov

Hi @vzhirnov. Thank you for raising this. I'll take a look into it.

en-milie avatar Jul 20 '22 07:07 en-milie

Hi @vzhirnov. Is there a particular reason for using custom extension for these objects instead of just placing them in the Components section?

en-milie avatar Jul 26 '22 15:07 en-milie

Hi @en-milie , sorry for long delay with the answer.

Yes, we can fix our swagger. And it will even be more conventional than using an extension for this, as we are currently doing. There are no good reasons for us to have just such a structure in the swagger. But your tool doesn't (sort of) follow the standard completely.

In short, we are not blocked by their bug, we can fix it ourselves. But you may want to fix this issue in your tool to meet the standard.

vzhirnov avatar Aug 18 '22 07:08 vzhirnov

I understand. Currently CATS does not support custom extensions. We will think about how to best support this in future releases, but it might be tricky as these being "custom" it's hard to acomodate all possible behaviours.

en-milie avatar Aug 19 '22 06:08 en-milie

Closing this for now.

en-milie avatar Aug 31 '22 13:08 en-milie