Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SharedCodegen to fallback to title usage if x-model is not present #21

Merged
merged 1 commit into from
Mar 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugin/src/main/java/com/yelp/codegen/SharedCodegen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ abstract class SharedCodegen : DefaultCodegen(), CodegenConfig {
}

/**
* Returns the x-model alternative name if it was defined
* Returns the x-model alternative name if it was defined.
* If the x-model alternative name is not found then the call will
* use the defined title, if any, or returns the input name
*/
fun matchXModel(name: String): String {
return xModelMatches[name] ?: name
return xModelMatches[name] ?: (
this.swagger?.definitions?.get(name)?.title ?: name
)
}

/**
Expand Down