forked from loafle/openapi-generator-original
[Kotlin][client] Add nullable query parameter support (#4197)
* add nullable query parameter support * remove redundant bracket
This commit is contained in:
parent
5d7bb17cc6
commit
9fe2f4d3ef
@ -1893,7 +1893,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(composed.getRequired() != null) {
|
if (composed.getRequired() != null) {
|
||||||
required.addAll(composed.getRequired());
|
required.addAll(composed.getRequired());
|
||||||
}
|
}
|
||||||
addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired);
|
addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired);
|
||||||
@ -2002,7 +2002,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
addProperties(properties, required, component);
|
addProperties(properties, required, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(schema.getRequired() != null) {
|
if (schema.getRequired() != null) {
|
||||||
required.addAll(schema.getRequired());
|
required.addAll(schema.getRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5022,7 +5022,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.pattern = codegenProperty.pattern;
|
codegenParameter.pattern = codegenProperty.pattern;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (codegenProperty.complexType != null) {
|
if (codegenProperty.complexType != null) {
|
||||||
imports.add(codegenProperty.complexType);
|
imports.add(codegenProperty.complexType);
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,21 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf<kotlin.String, List<kotlin.String>>()
|
{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
{{^required}}if ({{paramName}} != null) {
|
{{^required}}
|
||||||
|
if ({{paramName}} != null) {
|
||||||
put("{{paramName}}", {{#isContainer}}toMultiValue({{paramName}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{paramName}}.toString()){{/isContainer}})
|
put("{{paramName}}", {{#isContainer}}toMultiValue({{paramName}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{paramName}}.toString()){{/isContainer}})
|
||||||
}{{/required}}{{#required}}put("{{paramName}}", {{#isContainer}}toMultiValue({{paramName}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{paramName}}.toString()){{/isContainer}}){{/required}}
|
}
|
||||||
|
{{/required}}
|
||||||
|
{{#required}}
|
||||||
|
{{#isNullable}}
|
||||||
|
if ({{paramName}} != null) {
|
||||||
|
put("{{paramName}}", {{#isContainer}}toMultiValue({{paramName}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{paramName}}.toString()){{/isContainer}})
|
||||||
|
}
|
||||||
|
{{/isNullable}}
|
||||||
|
{{^isNullable}}
|
||||||
|
put("{{paramName}}", {{#isContainer}}toMultiValue({{paramName}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{paramName}}.toString()){{/isContainer}})
|
||||||
|
{{/isNullable}}
|
||||||
|
{{/required}}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
}
|
}
|
||||||
{{/hasQueryParams}}
|
{{/hasQueryParams}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user