-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Is your feature request related to a problem? Please describe.
Since OAS 3.0, in order to support common ways of serializing simple parameters, style and explode are defined instead of collectionFormat.
On the other hand, we still using collectionFormat: style and explode parameters are mapped to collectionFormat.
Lines 3083 to 3094 in 7dbda04
| // TDOO revise collectionFormat | |
| String collectionFormat = null; | |
| if (ModelUtils.isArraySchema(parameterSchema)) { // for array parameter | |
| final ArraySchema arraySchema = (ArraySchema) parameterSchema; | |
| Schema inner = getSchemaItems(arraySchema); | |
| if (arraySchema.getItems() == null) { | |
| arraySchema.setItems(inner); | |
| } | |
| collectionFormat = getCollectionFormat(parameter); | |
| // default to csv: | |
| collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat; |
Lines 4592 to 4609 in 7dbda04
| protected String getCollectionFormat(Parameter parameter) { | |
| if (Parameter.StyleEnum.FORM.equals(parameter.getStyle())) { | |
| // Ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-values | |
| if (Boolean.TRUE.equals(parameter.getExplode())) { // explode is true (default) | |
| return "multi"; | |
| } else { | |
| return "csv"; | |
| } | |
| } else if (Parameter.StyleEnum.SIMPLE.equals(parameter.getStyle())) { | |
| return "csv"; | |
| } else if (Parameter.StyleEnum.PIPEDELIMITED.equals(parameter.getStyle())) { | |
| return "pipe"; | |
| } else if (Parameter.StyleEnum.SPACEDELIMITED.equals(parameter.getStyle())) { | |
| return "space"; | |
| } else { | |
| return null; | |
| } | |
| } |
This can not representate serialization format required in OAS3.
Describe the solution you'd like
In order to make available the serialization format, explode and style parameter values should be assigned to mustache templates, and handle the parameters in each generator.
We need to keep collectionFormat until generators support style and explode.
Additional context
Related PR: #3984
Reactions are currently unavailable