Skip to content

Commit 08a09e3

Browse files
authored
Merge pull request #21 from macisamuele/maci-add-title-fallback
Update SharedCodegen to fallback to title usage if x-model is not present
2 parents 74d2a2b + e2772a3 commit 08a09e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugin/src/main/java/com/yelp/codegen/SharedCodegen.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ abstract class SharedCodegen : DefaultCodegen(), CodegenConfig {
122122
}
123123

124124
/**
125-
* Returns the x-model alternative name if it was defined
125+
* Returns the x-model alternative name if it was defined.
126+
* If the x-model alternative name is not found then the call will
127+
* use the defined title, if any, or returns the input name
126128
*/
127129
fun matchXModel(name: String): String {
128-
return xModelMatches[name] ?: name
130+
return xModelMatches[name] ?: (
131+
this.swagger?.definitions?.get(name)?.title ?: name
132+
)
129133
}
130134

131135
/**

0 commit comments

Comments
 (0)