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

[kotlin] back ticks escaping of keywords and more #11166

Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}},
{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}},
{{/-last}}{{/optionalVars}}
) {{/discriminator}}{{#parent}}: {{{.}}}(){{/parent}}{
) {{/discriminator}}{{#parent}}: {{{.}}}{{/parent}}{
{{#discriminator}}
{{#requiredVars}}
{{>interfaceReqVar}}
Expand All @@ -25,7 +25,7 @@
* {{{description}}}
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
*/
enum class {{nameInCamelCase}}(val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) {
enum class {{{nameInCamelCase}}}(val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) {
{{#allowableValues}}{{#enumVars}}
@JsonProperty({{{value}}}) {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}{{/allowableValues}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}}{{#deprecated}}
@Deprecated(message = ""){{/deprecated}}
@field:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}
@field:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInCamelCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grzegorz-moto thanks for the PR. I think you will need to remove EOF (which is likely added automatically by your text editor)

Same for https://github.com/OpenAPITools/openapi-generator/pull/11166/files#diff-f2fe24f5af2d6f356946c5a9aeff0eedc692f07aa12d6dd8658e4c1c9bff9c38R3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}}
@field:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}?{{/isReadOnly}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{#isReadOnly}}{{^defaultValue}} = null{{/defaultValue}}{{/isReadOnly}}
@field:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInCamelCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}?{{/isReadOnly}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{#isReadOnly}}{{^defaultValue}} = null{{/defaultValue}}{{/isReadOnly}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiModelProperty
data class Category(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,
@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") val name: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ import io.swagger.annotations.ApiModelProperty
data class ModelApiResponse(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("code") val code: kotlin.Int? = null,
@field:JsonProperty("code") val code: kotlin.Int? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("type") val type: kotlin.String? = null,
@field:JsonProperty("type") val type: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("message") val message: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,28 @@ import io.swagger.annotations.ApiModelProperty
data class Order(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("petId") val petId: kotlin.Long? = null,
@field:JsonProperty("petId") val petId: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("quantity") val quantity: kotlin.Int? = null,
@field:JsonProperty("quantity") val quantity: kotlin.Int? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
@field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null
,

@ApiModelProperty(example = "null", value = "Order Status")
@field:JsonProperty("status") val status: Order.Status? = null,
@field:JsonProperty("status") val status: Order.Status? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("complete") val complete: kotlin.Boolean? = false

) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,31 @@ import io.swagger.annotations.ApiModelProperty
data class Pet(

@ApiModelProperty(example = "doggie", required = true, value = "")
@field:JsonProperty("name", required = true) val name: kotlin.String,
@field:JsonProperty("name", required = true) val name: kotlin.String
,

@ApiModelProperty(example = "null", required = true, value = "")
@field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List<kotlin.String>,
@field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List<kotlin.String>
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,

@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("category") val category: Category? = null,
@field:JsonProperty("category") val category: Category? = null
,

@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
@field:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null
,

@ApiModelProperty(example = "null", value = "pet status in the store")
@Deprecated(message = "")
@field:JsonProperty("status") val status: Pet.Status? = null

) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiModelProperty
data class Tag(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") val name: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,36 @@ import io.swagger.annotations.ApiModelProperty
data class User(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("username") val username: kotlin.String? = null,
@field:JsonProperty("username") val username: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("firstName") val firstName: kotlin.String? = null,
@field:JsonProperty("firstName") val firstName: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("lastName") val lastName: kotlin.String? = null,
@field:JsonProperty("lastName") val lastName: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("email") val email: kotlin.String? = null,
@field:JsonProperty("email") val email: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("password") val password: kotlin.String? = null,
@field:JsonProperty("password") val password: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("phone") val phone: kotlin.String? = null,
@field:JsonProperty("phone") val phone: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "User Status")
@field:JsonProperty("userStatus") val userStatus: kotlin.Int? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiModelProperty
data class Category(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") var id: kotlin.Long? = null,
@field:JsonProperty("id") var id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") var name: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ import io.swagger.annotations.ApiModelProperty
data class ModelApiResponse(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("code") var code: kotlin.Int? = null,
@field:JsonProperty("code") var code: kotlin.Int? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("type") var type: kotlin.String? = null,
@field:JsonProperty("type") var type: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("message") var message: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,28 @@ import io.swagger.annotations.ApiModelProperty
data class Order(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") var id: kotlin.Long? = null,
@field:JsonProperty("id") var id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("petId") var petId: kotlin.Long? = null,
@field:JsonProperty("petId") var petId: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("quantity") var quantity: kotlin.Int? = null,
@field:JsonProperty("quantity") var quantity: kotlin.Int? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null,
@field:JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null
,

@ApiModelProperty(example = "null", value = "Order Status")
@field:JsonProperty("status") var status: Order.Status? = null,
@field:JsonProperty("status") var status: Order.Status? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("complete") var complete: kotlin.Boolean? = false

) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,30 @@ import io.swagger.annotations.ApiModelProperty
data class Pet(

@ApiModelProperty(example = "doggie", required = true, value = "")
@field:JsonProperty("name", required = true) var name: kotlin.String,
@field:JsonProperty("name", required = true) var name: kotlin.String
,

@ApiModelProperty(example = "null", required = true, value = "")
@field:JsonProperty("photoUrls", required = true) var photoUrls: kotlin.collections.List<kotlin.String>,
@field:JsonProperty("photoUrls", required = true) var photoUrls: kotlin.collections.List<kotlin.String>
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") var id: kotlin.Long? = null,
@field:JsonProperty("id") var id: kotlin.Long? = null
,

@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("category") var category: Category? = null,
@field:JsonProperty("category") var category: Category? = null
,

@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("tags") var tags: kotlin.collections.List<Tag>? = null,
@field:JsonProperty("tags") var tags: kotlin.collections.List<Tag>? = null
,

@ApiModelProperty(example = "null", value = "pet status in the store")
@field:JsonProperty("status") var status: Pet.Status? = null

) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiModelProperty
data class Tag(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") var id: kotlin.Long? = null,
@field:JsonProperty("id") var id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") var name: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,36 @@ import io.swagger.annotations.ApiModelProperty
data class User(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") var id: kotlin.Long? = null,
@field:JsonProperty("id") var id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("username") var username: kotlin.String? = null,
@field:JsonProperty("username") var username: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("firstName") var firstName: kotlin.String? = null,
@field:JsonProperty("firstName") var firstName: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("lastName") var lastName: kotlin.String? = null,
@field:JsonProperty("lastName") var lastName: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("email") var email: kotlin.String? = null,
@field:JsonProperty("email") var email: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("password") var password: kotlin.String? = null,
@field:JsonProperty("password") var password: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("phone") var phone: kotlin.String? = null,
@field:JsonProperty("phone") var phone: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "User Status")
@field:JsonProperty("userStatus") var userStatus: kotlin.Int? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import io.swagger.annotations.ApiModelProperty
data class Category(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("id") val id: kotlin.Long? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") val name: kotlin.String? = null

) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ import io.swagger.annotations.ApiModelProperty
data class ModelApiResponse(

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("code") val code: kotlin.Int? = null,
@field:JsonProperty("code") val code: kotlin.Int? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("type") val type: kotlin.String? = null,
@field:JsonProperty("type") val type: kotlin.String? = null
,

@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("message") val message: kotlin.String? = null

) {

}
Expand Down
Loading