[scala-sttp4-jsoniter] support set parameters (uniqueItems arrays) in query, header, path and cookie parameters
Parameters whose schema has uniqueItems: true are generated as Scala Set, but the serializers only matched Seq, so any Set parameter — including Set[String] — failed to compile with a Mirror.Of[Set[...]] error. This predates the enum-array work; Set was never handled.
Add Set[p] / Option[Set[p]] cases to FormSerializable, HeaderSerializable, PathSerializable and CookieSerializable. Because Set is invariant (unlike the covariant Seq), the element type is bound and dispatched on via erasedValue: primitives and enums both convert to Seq and reuse the existing array serialization, so all style/explode combinations keep working. Non-enum, non-primitive element types fail with a clear compile-time error.
Extend the sample spec with a Set of referenced enums (colors/PetColor) and a Set of primitives (uniqueTags) so the samples build exercises both paths.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Summary by cubic
Support Set[...] parameters in scala-sttp4-jsoniter across query, header, path, and cookie, and fix form serialization to omit empty arrays/sets. This unblocks uniqueItems arrays generated as Scala sets and avoids emitting empty param entries.
- Bug Fixes
- Added
Set[p]andOption[Set[p]]handling to Form, Header, Path, and Cookie serializers; supports primitives and referenced enums, with unsupported element types failing at compile time. - Form serialization now omits empty arrays/sets when
explode=false(noname=), matchingexplode=trueand optional semantics. Updated samples/spec to cover sets: addedPetColorenum anduniqueTags, and extendedfindPetsByTagswithcolors: Set[PetColor]anduniqueTags: Set[String].
- Added