I made a REST endpoint and an open-api documentation for it using SpringDoc+Swagger. Request body of endpoint has a field - set of objects. As I see in generated documentation, it's the same thing as array, except the uniqueItems
field:
"fooSet": {
"uniqueItems": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/Foo"
}
}
Frontend dev uses openapitools/openapi-generator-cli to interact with my endpoint using open-api docs. This lib enforces him to use JS Set in this case. But it cannot serialize Set properly! The openapi-generator-cli generated this code for serialization:
JSON.stringify returns empty array for any Set: JSON stringify a Set
- How can frontend dev customize set serialization? Without editing generated code manually, of course
- How can I disable
uniqueItems
for all Sets without having to replace all of them to Lists, or add annotation on each Set in each DTO?