diff --git a/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache b/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache index 804e23134966..fff80e88d9af 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache @@ -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() ) diff --git a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/PathApiStubs.kt b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/PathApiStubs.kt index 011d4e396e0c..06631292ca5a 100644 --- a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/PathApiStubs.kt +++ b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/PathApiStubs.kt @@ -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() ) } diff --git a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/QueryApiStubs.kt b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/QueryApiStubs.kt index 96f7bf35cb21..16e0718142ff 100644 --- a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/QueryApiStubs.kt +++ b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/QueryApiStubs.kt @@ -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() ) @@ -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() ) @@ -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() ) @@ -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() ) @@ -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() ) @@ -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() ) }