Skip to content

Commit dcc8b64

Browse files
committed
Merge branch 'refs/heads/main' into 2024.6.x
# Conflicts: # gradle/libs.versions.toml
2 parents 5609dfc + a9a36b3 commit dcc8b64

File tree

20 files changed

+42
-70
lines changed

20 files changed

+42
-70
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/OptionsConverter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class OptionsConverter(private val checkObsoleteProcessorOptions: Boolean = fals
7474
val (enablePathPrefix, pathPrefixServerIndex) = checkServerUrl(mapping.options)
7575
options.basePathOptions.enabled = enablePathPrefix
7676
options.basePathOptions.serverUrl = pathPrefixServerIndex
77-
options.basePathOptions.propertiesName = mapping.options.basePath.profileName
77+
options.basePathOptions.propertiesName = mapping.options.basePath.propertiesName
7878
// to write the base path resource we need standard layout
7979
if (options.basePathOptions.enabled && !options.targetDirOptions.standardLayout) {
8080
log.warn("base-path is enabled, forcing target-dir.layout = standard")
@@ -122,7 +122,7 @@ class OptionsConverter(private val checkObsoleteProcessorOptions: Boolean = fals
122122
return when (options.basePath.serverUrl) {
123123
"false" -> Pair(false, null)
124124
"true" -> Pair(true, 0)
125-
else -> Pair(true, options.basePath.serverUrl?.toInt())
125+
else -> Pair(true, options.basePath.serverUrl.toInt())
126126
}
127127
}
128128

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/AnnotationNameMappingDefault.kt renamed to openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/AnnotationNameTypeMappingDefault.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package io.openapiprocessor.core.converter.mapping
77

8-
open class AnnotationNameMappingDefault(
8+
open class AnnotationNameTypeMappingDefault(
99
/**
1010
* The parameter name of this mapping. Must match 1:1 with what is written in the api.
1111
*/

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/EndpointMappings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ class EndpointMappings(
175175
fun findAnnotationParameterNameTypeMapping(query: MappingQuery): List<AnnotationNameMapping> {
176176
val httpMethodMappings = methodMappings[query.method]
177177
val methodMappings = httpMethodMappings?.findAnnotationParameterNameTypeMapping(
178-
AnnotationParameterNameMatcher(query))
178+
AnnotationParameterNameTypeMatcher(query))
179179
if (!methodMappings.isNullOrEmpty()) {
180180
log.trace("found endpoint method annotation parameter name type mappings ({} {})", query.path, query.method)
181181
return methodMappings
182182
}
183183

184-
val mappings = mappings.findAnnotationParameterNameTypeMapping(AnnotationParameterNameMatcher(query))
184+
val mappings = mappings.findAnnotationParameterNameTypeMapping(AnnotationParameterNameTypeMatcher(query))
185185
log.trace("found endpoint annotation parameter name type mapping ({})", query.path)
186186
return mappings
187187
}
@@ -201,13 +201,13 @@ class EndpointMappings(
201201

202202
fun findContentTypeMapping(query: MappingQuery): ContentTypeMapping? {
203203
val httpMethodMappings = methodMappings[query.method]
204-
val methodMapping = httpMethodMappings?.findContentTypeMapping(ResponseTypeMatcher(query))
204+
val methodMapping = httpMethodMappings?.findContentTypeMapping(ContentTypeMatcher(query))
205205
if (methodMapping != null) {
206206
log.trace("found endpoint method content type mapping ({} {})", query.path, query.method)
207207
return methodMapping
208208
}
209209

210-
val mapping = mappings.findContentTypeMapping(ResponseTypeMatcher(query))
210+
val mapping = mappings.findContentTypeMapping(ContentTypeMatcher(query))
211211
if (mapping != null) {
212212
log.trace("found endpoint content type mapping ({})", query.path)
213213
return mapping

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/MappingBucket.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package io.openapiprocessor.core.converter.mapping
77

8-
interface MappingBucket {
8+
fun interface MappingBucket {
99
/**
1010
* filter the mapping(s) by the given filter.
1111
*

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/MappingRepository.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ class MappingRepository(
5454
}
5555

5656
fun findGlobalAnnotationParameterNameTypeMapping(query: MappingQuery): List<AnnotationNameMapping> {
57-
return globalMappings.findAnnotationParameterNameTypeMapping(AnnotationParameterNameMatcher(query))
57+
return globalMappings.findAnnotationParameterNameTypeMapping(AnnotationParameterNameTypeMatcher(query))
5858
}
5959

6060
fun findGlobalAddParameterTypeMappings(): List<AddParameterTypeMapping> {
6161
return globalMappings.findAddParameterTypeMappings(AddParameterTypeMatcher())
6262
}
6363

6464
fun findGlobalContentTypeMapping(query: MappingQuery): ContentTypeMapping? {
65-
return globalMappings.findContentTypeMapping(ResponseTypeMatcher(query))
65+
return globalMappings.findContentTypeMapping(ContentTypeMatcher(query))
6666
}
6767

6868
fun getEndpointResultTypeMapping(query: MappingQuery): ResultTypeMapping? {

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/matcher/AnnotationParameterNameMatcher.kt renamed to openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/matcher/AnnotationParameterNameTypeMatcher.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import io.openapiprocessor.core.converter.mapping.*
99
import org.slf4j.Logger
1010
import org.slf4j.LoggerFactory
1111

12-
// todo AnnotationParameterNameTypeMatcher
13-
class AnnotationParameterNameMatcher(private val query: MappingQuery): MappingMatcher {
12+
class AnnotationParameterNameTypeMatcher(private val query: MappingQuery): MappingMatcher {
1413
val log: Logger = LoggerFactory.getLogger(this.javaClass.name)
1514

1615
override fun match(mapping: Mapping): Boolean {

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/matcher/ResponseTypeMatcher.kt renamed to openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/mapping/matcher/ContentTypeMatcher.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import io.openapiprocessor.core.converter.mapping.*
99
import org.slf4j.Logger
1010
import org.slf4j.LoggerFactory
1111

12-
// todo ContentTypeMatcher
13-
class ResponseTypeMatcher(private val query: MappingQuery): MappingMatcher, (ContentTypeMapping) -> Boolean {
12+
class ContentTypeMatcher(private val query: MappingQuery): MappingMatcher, (ContentTypeMapping) -> Boolean {
1413
val log: Logger = LoggerFactory.getLogger(this.javaClass.name)
1514

1615
override fun match(mapping: Mapping): Boolean {

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/processor/mapping/v2/BasePath.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ data class BasePath(
1414
/**
1515
* profile name for base path.
1616
*/
17-
val profileName: String = "api.properties"
17+
val propertiesName: String = "api.properties"
1818
)

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/processor/mapping/v2/MappingConverter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class MappingConverter(val mapping: MappingV2) {
218218
val (mapping, genericTypes) = parseMapping(source.name, source.generics)
219219

220220
return if (mapping.kind == ANNOTATE) {
221-
AnnotationNameMappingDefault(mapping.sourceType!!, Annotation(
221+
AnnotationNameTypeMappingDefault(mapping.sourceType!!, Annotation(
222222
mapping.annotationType!!,
223223
mapping.annotationParameters)
224224
)
@@ -425,7 +425,7 @@ class MappingConverter(val mapping: MappingV2) {
425425
throw BadMappingException(source.type)
426426
}
427427

428-
return AnnotationNameMappingDefault(mapping.sourceType!!, Annotation(
428+
return AnnotationNameTypeMappingDefault(mapping.sourceType!!, Annotation(
429429
mapping.annotationType!!,
430430
mapping.annotationParameters))
431431
}

openapi-processor-core/src/test/kotlin/io/openapiprocessor/core/converter/OptionsConverterSpec.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class OptionsConverterSpec: StringSpec({
114114
format-code: false
115115
base-path:
116116
server-url: 0
117-
profile-name: openapi.properties
117+
properties-name: openapi.properties
118118
compatibility:
119119
bean-validation-valid-on-reactive: false
120120
identifier-word-break-from-digit-to-letter: false
@@ -200,7 +200,7 @@ class OptionsConverterSpec: StringSpec({
200200
package-name: no.warning
201201
base-path:
202202
server-url: ${su.source}
203-
profile-name: openapi.properties
203+
properties-name: openapi.properties
204204
""".trimIndent()
205205
))
206206

@@ -221,7 +221,7 @@ class OptionsConverterSpec: StringSpec({
221221
package-name: pkg
222222
base-path:
223223
server-url: true
224-
profile-name: openapi.properties
224+
properties-name: openapi.properties
225225
""".trimIndent()
226226
))
227227

0 commit comments

Comments
 (0)