Edit Invitations API annotation
There is a discrepancy between Rails and OpenAPI V2 where the Array type annotation for Rails does not support comma-separated strings while OpenAPI supports Arrays in the form of comma-separated strings via the collectionFormat: csv
option (https://swagger.io/specification/v2/#parameterCollectionFormat). grape-swagger
only takes the first type
in the types
array because OpenAPI V2 does not support multiple types. As such, the current OpenAPI output would only support singular email
or user_id
parameters.
Fortunately, we already have the coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce
helper that bridges this discrepancy. However, this creates one edge case where the EmailOrEmailList
validator (via email_or_email_list: true,
) fails because it is now being passed an Array while it expects a string. I added this case to EmailOrEmailList
.
Furthermore, it appears that using coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce
for user_id
breaks several UI tests as it is actually expected to be able to to_s
(for a single Integer) or is an array of strings.
The OpenAPI V2 documentation will be used for dogfooding API fuzzing as per #372422 (closed) and the OpenAPI autogeneration &8926.