Endava / cats

CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints. CATS automatically generates, runs and reports tests with minimum configuration and no coding effort. Tests are self-healing and do not require maintenance.
Apache License 2.0
1.11k stars 76 forks source link

[FunctionalFuzzer] Warning on nullable enum #100

Closed Peekmo closed 4 months ago

Peekmo commented 4 months ago

Describe the bug If a nullable enum is described in the OPEN API response like described here, there is a warning from cats (Response does NOT match expected result. Response code [201] is documented, but response body does NOT matches the corresponding schema.)

To Reproduce For an attribute described as nullable enum like that :

myStatus:
          type: string
          nullable: true
          enum: [null, "pending", "success", "failed"]
          description: Status

If the API tested returns null you have the warning

Expected behaviour It should be a success

Environment:

Key           | Value
------------- | --------------------
OS Name       | Mac OS X
OS Version    | 12.6.2
OS Arch       | x86_64
Binary Type   | uber-jar
Cats Version  | 10.5.0
Cats Build    | 2024-02-05T08:10:13Z
Term Width    | 153
Term Type     | xterm-256color
Shell         | /usr/local/bin/zsh

Additional context Removing the null value from the enum removes the warning e.g :

myStatus:
          type: string
          nullable: true
          enum: ["pending", "success", "failed"]
          description: Status

But in the linked description from Swagger, it says to add the null value for a nullable enum.

Thank you

en-milie commented 4 months ago

This is now fixed.

en-milie commented 4 months ago

Fix is available in latest release: https://github.com/Endava/cats/releases/tag/cats-11.0.0