File tree Expand file tree Collapse file tree 6 files changed +34
-7
lines changed
openapi-processor-core/src
main/kotlin/io/openapiprocessor/core/writer/java
testInt/resources/tests/keyword-identifier Expand file tree Collapse file tree 6 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ class DataTypeWriterPojo(
219219 result + = ifDeprecated(propDataType)
220220
221221 result + = """
222- | public ${propDataType.getTypeName()} get${toAccessor (propertyName.capitalizeFirstChar())} () {
222+ | public ${propDataType.getTypeName()} get${toMethodTail (propertyName.capitalizeFirstChar())} () {
223223 | return ${toIdentifier(propertyName)} ;
224224 | }
225225 |
@@ -236,7 +236,7 @@ class DataTypeWriterPojo(
236236 val property = toIdentifier(propertyName)
237237
238238 result + = """
239- | public void set${toAccessor (propertyName.capitalizeFirstChar())} (${propDataType.getTypeName()} ${property} ) {
239+ | public void set${toMethodTail (propertyName.capitalizeFirstChar())} (${propDataType.getTypeName()} ${property} ) {
240240 | this.${property} = ${property} ;
241241 | }
242242 |
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ fun toIdentifier(src: String): String {
5858 * @param src the source property name without get/set prefix
5959 * @return a valid accessor name without get/set prefix
6060 */
61- fun toAccessor (src : String ): String {
61+ fun toMethodTail (src : String ): String {
6262 return when (src) {
6363 " Class" -> " AClass"
6464 else -> src
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ open class MethodWriter(
8585 val tail = camel.subList(1 , camel.count())
8686 .joinToString(" " ) { it.capitalizeFirstChar() }
8787
88+ if (endpoint.parameters.isEmpty() || endpoint.requestBodies.isNotEmpty()) {
89+ return head + toMethodTail(tail)
90+ }
91+
8892 return head + tail
8993 }
9094
Original file line number Diff line number Diff line change 88@ Generated (value = "openapi-processor-core" , version = "test" )
99public interface Api {
1010
11- @ Mapping ("/keywords" )
12- Class getKeywords (@ Parameter Class aClass );
11+ @ Mapping ("/class" )
12+ Class getAClass ();
13+
14+ @ Mapping ("/class" )
15+ Class postClass (@ Parameter Class aClass );
1316
1417}
Original file line number Diff line number Diff line change 55
66paths :
77
8- /keywords :
8+ /class :
99 get :
10+ responses :
11+ ' 200 ' :
12+ description : the foo result
13+ content :
14+ application/json :
15+ schema :
16+ $ref : ' #/components/schemas/class'
17+
18+ post :
1019 parameters :
1120 - name : class
1221 description : parameter
2130 schema :
2231 $ref : ' #/components/schemas/class'
2332
33+
2434components :
2535 schemas :
2636
Original file line number Diff line number Diff line change 55
66paths :
77
8- /keywords :
8+ /class :
99 get :
10+ responses :
11+ ' 200 ' :
12+ description : the foo result
13+ content :
14+ application/json :
15+ schema :
16+ $ref : ' #/components/schemas/class'
17+
18+ post :
1019 parameters :
1120 - name : class
1221 description : parameter
2130 schema :
2231 $ref : ' #/components/schemas/class'
2332
33+
2434components :
2535 schemas :
2636
You can’t perform that action at this time.
0 commit comments