Skip to content

Commit

Permalink
[BUG] Kotlin wiremock query params are incorrect (OpenAPITools#19720)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankoppier authored Sep 30, 2024
1 parent d68a186 commit df22ca6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ open class {{classname}}Stubs(private val objectMapper: ObjectMapper) {
fun {{operationId}}({{#pathParams}}{{paramName}}: StringValuePattern, {{/pathParams}}{{#queryParams}}{{paramName}}: StringValuePattern? = null, {{/queryParams}}configurer: MappingBuilder.() -> MappingBuilder = { this }): {{operationIdCamelCase}}StubBuilder =
{{operationIdCamelCase}}StubBuilder(objectMapper, {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(urlPathTemplate("{{path}}"))
{{#pathParams}}
.withPathParam("{{paramName}}", {{paramName}})
.withPathParam("{{baseName}}", {{paramName}})
{{/pathParams}}
{{#queryParams}}
.apply { {{paramName}}?.let { withQueryParam("{{paramName}}", it) } }
.apply { {{paramName}}?.let { withQueryParam("{{baseName}}", it) } }
{{/queryParams}}
.configurer()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ open class PathApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: StringValuePattern, pathInteger: StringValuePattern, enumNonrefStringPath: StringValuePattern, enumRefStringPath: StringValuePattern, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathStubBuilder =
TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathStubBuilder(objectMapper, get(urlPathTemplate("/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}"))
.withPathParam("pathString", pathString)
.withPathParam("pathInteger", pathInteger)
.withPathParam("enumNonrefStringPath", enumNonrefStringPath)
.withPathParam("enumRefStringPath", enumRefStringPath)
.withPathParam("path_string", pathString)
.withPathParam("path_integer", pathInteger)
.withPathParam("enum_nonref_string_path", enumNonrefStringPath)
.withPathParam("enum_ref_string_path", enumRefStringPath)
.configurer()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testEnumRefString(enumNonrefStringQuery: StringValuePattern? = null, enumRefStringQuery: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestEnumRefStringStubBuilder =
TestEnumRefStringStubBuilder(objectMapper, get(urlPathTemplate("/query/enum_ref_string"))
.apply { enumNonrefStringQuery?.let { withQueryParam("enumNonrefStringQuery", it) } }
.apply { enumRefStringQuery?.let { withQueryParam("enumRefStringQuery", it) } }
.apply { enumNonrefStringQuery?.let { withQueryParam("enum_nonref_string_query", it) } }
.apply { enumRefStringQuery?.let { withQueryParam("enum_ref_string_query", it) } }
.configurer()
)

Expand All @@ -44,9 +44,9 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testQueryDatetimeDateString(datetimeQuery: StringValuePattern? = null, dateQuery: StringValuePattern? = null, stringQuery: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestQueryDatetimeDateStringStubBuilder =
TestQueryDatetimeDateStringStubBuilder(objectMapper, get(urlPathTemplate("/query/datetime/date/string"))
.apply { datetimeQuery?.let { withQueryParam("datetimeQuery", it) } }
.apply { dateQuery?.let { withQueryParam("dateQuery", it) } }
.apply { stringQuery?.let { withQueryParam("stringQuery", it) } }
.apply { datetimeQuery?.let { withQueryParam("datetime_query", it) } }
.apply { dateQuery?.let { withQueryParam("date_query", it) } }
.apply { stringQuery?.let { withQueryParam("string_query", it) } }
.configurer()
)

Expand All @@ -61,9 +61,9 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testQueryIntegerBooleanString(integerQuery: StringValuePattern? = null, booleanQuery: StringValuePattern? = null, stringQuery: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestQueryIntegerBooleanStringStubBuilder =
TestQueryIntegerBooleanStringStubBuilder(objectMapper, get(urlPathTemplate("/query/integer/boolean/string"))
.apply { integerQuery?.let { withQueryParam("integerQuery", it) } }
.apply { booleanQuery?.let { withQueryParam("booleanQuery", it) } }
.apply { stringQuery?.let { withQueryParam("stringQuery", it) } }
.apply { integerQuery?.let { withQueryParam("integer_query", it) } }
.apply { booleanQuery?.let { withQueryParam("boolean_query", it) } }
.apply { stringQuery?.let { withQueryParam("string_query", it) } }
.configurer()
)

Expand All @@ -76,7 +76,7 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestQueryStyleDeepObjectExplodeTrueObjectStubBuilder =
TestQueryStyleDeepObjectExplodeTrueObjectStubBuilder(objectMapper, get(urlPathTemplate("/query/style_deepObject/explode_true/object"))
.apply { queryObject?.let { withQueryParam("queryObject", it) } }
.apply { queryObject?.let { withQueryParam("query_object", it) } }
.configurer()
)

Expand All @@ -89,7 +89,7 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testQueryStyleFormExplodeTrueArrayString(queryObject: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestQueryStyleFormExplodeTrueArrayStringStubBuilder =
TestQueryStyleFormExplodeTrueArrayStringStubBuilder(objectMapper, get(urlPathTemplate("/query/style_form/explode_true/array_string"))
.apply { queryObject?.let { withQueryParam("queryObject", it) } }
.apply { queryObject?.let { withQueryParam("query_object", it) } }
.configurer()
)

Expand All @@ -102,7 +102,7 @@ open class QueryApiStubs(private val objectMapper: ObjectMapper) {
*/
fun testQueryStyleFormExplodeTrueObject(queryObject: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestQueryStyleFormExplodeTrueObjectStubBuilder =
TestQueryStyleFormExplodeTrueObjectStubBuilder(objectMapper, get(urlPathTemplate("/query/style_form/explode_true/object"))
.apply { queryObject?.let { withQueryParam("queryObject", it) } }
.apply { queryObject?.let { withQueryParam("query_object", it) } }
.configurer()
)
}

0 comments on commit df22ca6

Please sign in to comment.