-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Multi-valued parameters in path or query are not checked against collectionFormat #63
Comments
Are you saying that validate isn't checking that it's there, or isn't checking that the type matches what comes in?
|
Hello greg. The specification is ambiguous because it says two things:
Whatever, the spec package does not fill in the blanks with a "csv" value in this situation. I also stumbled on another inconsistency: you may define simple params as arrays, and even arrays of arrays of arrays... It's legal for simple schema objects. |
"for query or path parameters of type array, there MUST be a collectionFormat" Where are you seeing this? I can't find it. |
You are right, I did NOT get it from the official spec on 2.0. |
So if it is advisory only, I might add a warning some day in validate. |
Sorry for misleading previous post: I believe you're right - it is NOT stated as mandatory in official 2.0 spec |
I can see how "must be defined with type: array and the appropriate collectionFormat." can be confusing. It sounds like it is required. You need to realize that collectionFormat has a default, and thus not providing collectionFormat is appropriate for csv type. |
How about examples and default values for such a param? |
it's already unpacked at runtime validation time |
I understand that for runtime validation. Should the example value be expected in the collectionFormat form? |
It should still follow the same rules. So when collectionFormat is not present it should use the default strategy which is csv |
ok. This does not work like this currently. Same for default values. Thanks |
sorry yes the collecitonformat is only a parsing hint. The example value in the spec is the collection not the string to which the collectionformat is applied |
Hello @casualjim Template server/parameter.gotmpl obvisously takes the value litterally to parse it. Do you think I should attempt to fix the template and stick to the idea of defining default values as the types tells, no as the parsing hint tells? |
The Swagger 2 spec says
|
That tells me we need to fix the test, as its default doesn't match the type. |
Done. |
Template simply does NOT fit for default value in array params (not to say, nested arrays). |
According to spec, a multi-valued parameter in path or query (simple parameter) MUST be accompanied by the appropriate collectionFormation definition.
This check is currently not carried on by validate [results in wrong go-swagger code generation]
The text was updated successfully, but these errors were encountered: