cats icon indicating copy to clipboard operation
cats copied to clipboard

Enum list generates duplicates entry.

Open sauvainr opened this issue 6 months ago • 2 comments

Describe the bug Array parameters and attributes with a list of string generates duplicates value. This regardless of the parameter being defined in request body or query parameters. Or if the array list is an enum or not.

In normal cases that might be fine, but this breaks attributes with the uniqueItems: true clause. This obviously will get rejected due to the uniqueItems clause and failing the happy path tests.

To work around it I have to hard set the attribute list into the refData file which is not ideal.

To Reproduce Steps to reproduce the behaviour: Define a parameter or attribute as follow: type: array uniqueItems: true # Optional items: type: string Run cats generate -c swagger.yaml -X POST --path /path The fuzzer will generate a list with the same value twice. ['valuea','valuea'] regardless of the parameter being defined in request body or query parameters.

Expected behaviour Generated array should have a single occurrence of the value.

Environment:

Key Value
OS Name Linux
OS Version 5.10.16.3-microsoft-standard-WSL2
OS Arch amd64
Binary Type native
Cats Version 13.2.0
Cats Build 2025-05-12T05:45:14Z
Term Width 121
Term Type xterm-256color
Shell /bin/bash

Unfortunately, I cannot share the api Swagger and the FunctionalFuzzer directly, however I believe the behavior is not specific to the functionalFuzzer and also exists in regular fuzzers.

sauvainr avatar Jun 05 '25 01:06 sauvainr

@sauvainr Thanks you for the report. Indeed, uniqueness is ignored for now. I’ll work on a fix for the next release.

en-milie avatar Jun 05 '25 06:06 en-milie

Available in https://github.com/Endava/cats/releases/tag/cats-13.3.2

en-milie avatar Jun 26 '25 20:06 en-milie