Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 9c1a206

Browse files
authored
Merge pull request #40 from openapi-processor/#35
resolves #35
2 parents ed0be65 + 1c41048 commit 9c1a206

File tree

3 files changed

+46
-11
lines changed

3 files changed

+46
-11
lines changed

build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ java {
2020
}
2121

2222
ext {
23-
processorApiVersion = '1.1.0'
24-
jacksonVersion = '2.11.3'
23+
processorApiVersion = '1.2.0'
24+
jacksonVersion = '2.12.0'
2525

2626
bintrayUser = project.findProperty ('BINTRAY_USER') ?: System.getenv ("BINTRAY_USER") ?: 'n/a'
2727
bintrayKey = project.findProperty ('BINTRAY_KEY') ?: System.getenv ("BINTRAY_KEY") ?: 'n/a'
@@ -98,13 +98,13 @@ dependencies {
9898
components.all(JacksonPlatformRule)
9999
components.all(KotlinPlatformRule)
100100

101-
antlr 'org.antlr:antlr4:4.8'
101+
antlr 'org.antlr:antlr4:4.9'
102102

103103
compileOnly "io.openapiprocessor:openapi-processor-api:$processorApiVersion"
104104
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
105105

106106
implementation 'org.openapi4j:openapi-parser:1.0.4'
107-
implementation ('io.swagger.parser.v3:swagger-parser:2.0.21') {
107+
implementation ('io.swagger.parser.v3:swagger-parser:2.0.23') {
108108
exclude group: 'io.swagger.parser.v3', module: 'swagger-parser-v2-converter'
109109
exclude group: 'io.swagger.core.v3', module: 'swagger-annotations'
110110
}
@@ -113,7 +113,7 @@ dependencies {
113113
exclude group: 'com.google.guava'
114114
}
115115

116-
implementation ('com.google.guava:guava:29.0-jre') {
116+
implementation ('com.google.guava:guava:30.0-jre') {
117117
exclude group: 'com.google.guava'
118118
exclude group: 'com.google.j2objc'
119119
exclude group: 'com.google.code.findbugs'
@@ -126,7 +126,7 @@ dependencies {
126126
testImplementation 'org.codehaus.groovy:groovy-nio:2.5.12'
127127

128128
testImplementation "io.openapiprocessor:openapi-processor-api:$processorApiVersion"
129-
testImplementation ('io.openapiprocessor:openapi-processor-test:1.0.1') {
129+
testImplementation ('io.openapiprocessor:openapi-processor-test:2020.1.0') {
130130
exclude group: 'com.google.guava'
131131
}
132132

@@ -148,8 +148,8 @@ dependencies {
148148
exclude group: 'junit'
149149
}
150150
testImplementation("io.mockk:mockk:1.10.2")
151-
testImplementation("io.kotest:kotest-runner-junit5:4.2.5")
152-
testImplementation 'net.bytebuddy:byte-buddy:1.10.16'
151+
testImplementation("io.kotest:kotest-runner-junit5:4.3.1")
152+
testImplementation 'net.bytebuddy:byte-buddy:1.10.18'
153153
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
154154
}
155155

src/main/kotlin/io/openapiprocessor/core/converter/ApiConverter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class ApiConverter(
346346
var targetInterfaceName = INTERFACE_DEFAULT_NAME
347347

348348
if((op.hasTags())) {
349-
targetInterfaceName = op.getFirstTag()!!
349+
targetInterfaceName = toClass(op.getFirstTag()!!)
350350
}
351351

352352
if (excluded) {

src/test/groovy/com/github/hauner/openapi/core/converter/ApiConverterSpec.groovy

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,46 @@ paths:
7474
.convert (openApi)
7575

7676
then:
77-
assertInterfaces ('ping', 'pong')
77+
assertInterfaces ('Ping', 'Pong')
7878
assertPingEndpoints ('/a', '/c')
7979
assertPongEndpoints ('/b')
8080
}
8181

82+
void "groups endpoints into interfaces by valid tag identifier" () {
83+
def openApi = parse (
84+
"""\
85+
openapi: 3.0.2
86+
info:
87+
title: API
88+
version: 1.0.0
89+
90+
paths:
91+
/a:
92+
get:
93+
tags:
94+
- test_api
95+
responses:
96+
'204':
97+
description: none
98+
/b:
99+
get:
100+
tags:
101+
- test-api
102+
responses:
103+
'204':
104+
description: none
105+
106+
""")
107+
108+
when:
109+
api = new ApiConverter (new ApiOptions(), Stub (Framework))
110+
.convert (openApi)
111+
112+
then:
113+
def actual = api.interfaces
114+
assert actual.size () == 1
115+
assert actual.first ().name == "TestApi"
116+
}
82117

83118
@Unroll
84119
void "groups endpoints with method #method into interfaces" () {
@@ -119,7 +154,7 @@ paths:
119154
w.write (writer, api.interfaces.get (0))
120155

121156
then:
122-
assertInterfaces (method)
157+
assertInterfaces (method.capitalize ())
123158
assertEndpoints (method,'/a')
124159

125160
where:

0 commit comments

Comments
 (0)