Can anyone explain me why a new property-name with suffix [] is added to the list of property descriptions when the match-type is exact (or when matching an association? Probably i am missing something very obvious here, but i could not deduct this from the existing documentation :1234:
I think the documentation about the support for multiple values was lost somewhere along the way... But basically, you could do for example:
/books?author[]=/authors/1&author[]=/authors/2
The effect is equivalent to the SQL IN operator.
Or perhaps it was never properly documented? But it's been around for a long time: https://github.com/api-platform/core/pull/500#issuecomment-212929769 :laughing:
@teohhanhui Thanks for your answer (and sorry for my late reply :yum: ), it does make sense to be able to send in multiple values :+1: .
The swagger definition now contains the two definitions for the same parameter as well, where they are both the same scalar type. If a client is generated this give a pretty weird method signature (i.m.o). Your example would become getBooks(String author1, String author2); i would expect a signature getBooks(String author, List
Shouldn't the generated swagger type for the multi-value scalar be an array?
We must fix our Swagger generator to use collectionFormat: multi: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterCollectionFormat
We'll need to document both parameter foo and foo[] because the brackets notation is PHP-specific. Swagger considers both parameters as different ones.
Is it an idea to make the behavior of the generation of the two parameters configurable (like list-only, single-only or both)?
Would be nice.
Closed in favor of: https://github.com/api-platform/docs/issues/601