All Downloads are FREE. Search and download functionalities are using the official Maven repository.

openapi.templates.kora.kotlinModel.mustache Maven / Gradle / Ivy

The newest version!
/**
 * NOTE: This class is auto generated by Kora OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
package {{package}}

{{#models}}
{{#model}}
{{#isEnum}}
{{>kotlinEnumClass}}
{{/isEnum}}
{{^isEnum}}

{{#discriminator}}
/**
 * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
 */
@ru.tinkoff.kora.common.annotation.Generated("openapi generator kora kotlin")
@ru.tinkoff.kora.json.common.annotation.Json
@ru.tinkoff.kora.json.common.annotation.JsonDiscriminatorField("{{{propertyBaseName}}}")
sealed interface {{classname}} {
{{#allVars}}{{^isDiscriminator}}
  /**
   * {{#description}}{{.}}{{/description}}{{^description}}{{name}}{{/description}} {{#example}}
   * (example: {{.}}){{/example}}
   */
  val {{name}}: {{^vendorExtensions.x-json-nullable}}{{{datatypeWithEnum}}}{{^required}}?{{/required}}{{/vendorExtensions.x-json-nullable}}{{#vendorExtensions.x-json-nullable}}ru.tinkoff.kora.json.common.JsonNullable<{{{datatypeWithEnum}}}>{{/vendorExtensions.x-json-nullable}}
{{/isDiscriminator}}{{/allVars}}
}
{{/discriminator}}
{{^discriminator}}
/**
 * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}{{#allVars}}
 * @param {{name}} {{#description}}{{.}}{{/description}}{{^description}}{{name}}{{/description}}{{#example}} (example: {{.}}){{/example}}{{/allVars}}
 */
@ru.tinkoff.kora.common.annotation.Generated("openapi generator kora kotlin")
{{#additionalModelTypeAnnotations}}
{{{.}}}
{{/additionalModelTypeAnnotations}}
@ru.tinkoff.kora.json.common.annotation.JsonWriter{{#vendorExtensions.x-discriminator-value}}
@ru.tinkoff.kora.json.common.annotation.JsonDiscriminatorValue(value = {{{vendorExtensions.x-discriminator-value}}}){{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-enable-validation}}
@ru.tinkoff.kora.validation.common.annotation.Valid{{/vendorExtensions.x-enable-validation}}
{{#hasVars}}data {{/hasVars}}class {{classname}} @ru.tinkoff.kora.json.common.annotation.JsonReader constructor (
{{#requiredVars}}
  @ru.tinkoff.kora.json.common.annotation.JsonField("{{baseName}}")
  {{#vendorExtensions.x-has-min-max}}@ru.tinkoff.kora.validation.common.annotation.Range(from = {{minimum}}.toDouble(), to = {{maximum}}.toDouble(), boundary = ru.tinkoff.kora.validation.common.annotation.Range.Boundary.{{#exclusiveMinimum}}EXCLUSIVE{{/exclusiveMinimum}}{{^exclusiveMinimum}}INCLUSIVE{{/exclusiveMinimum}}_{{#exclusiveMaximum}}EXCLUSIVE{{/exclusiveMaximum}}{{^exclusiveMaximum}}INCLUSIVE{{/exclusiveMaximum}})
  {{/vendorExtensions.x-has-min-max}}{{#vendorExtensions.x-has-min-max-items}}@ru.tinkoff.kora.validation.common.annotation.Size(min = {{minItems}}, max = {{maxItems}})
  {{/vendorExtensions.x-has-min-max-items}}{{#vendorExtensions.x-has-min-max-length}}@ru.tinkoff.kora.validation.common.annotation.Size(min = {{minLength}}, max = {{maxLength}})
  {{/vendorExtensions.x-has-min-max-length}}{{#vendorExtensions.x-has-pattern}}@ru.tinkoff.kora.validation.common.annotation.Pattern("{{{pattern}}}")
  {{/vendorExtensions.x-has-pattern}}{{#vendorExtensions.x-has-valid-model}}@ru.tinkoff.kora.validation.common.annotation.Valid
  {{/vendorExtensions.x-has-valid-model}}
{{^isDiscriminator}}{{#isOverridden}}override {{/isOverridden}}{{/isDiscriminator}}val {{name}}: {{^vendorExtensions.x-json-nullable}}{{{datatypeWithEnum}}}{{/vendorExtensions.x-json-nullable}}{{#vendorExtensions.x-json-nullable}}ru.tinkoff.kora.json.common.JsonNullable<{{{datatypeWithEnum}}}>{{/vendorExtensions.x-json-nullable}}{{^-last}},{{/-last}}{{#-last}}{{#hasOptional}},{{/hasOptional}}{{/-last}}
{{/requiredVars}}{{#optionalVars}}
  @ru.tinkoff.kora.json.common.annotation.JsonField("{{baseName}}")
  {{#vendorExtensions.x-has-min-max}}@ru.tinkoff.kora.validation.common.annotation.Range(from = {{minimum}}.toDouble(), to = {{maximum}}.toDouble(), boundary = ru.tinkoff.kora.validation.common.annotation.Range.Boundary.{{#exclusiveMinimum}}EXCLUSIVE{{/exclusiveMinimum}}{{^exclusiveMinimum}}INCLUSIVE{{/exclusiveMinimum}}_{{#exclusiveMaximum}}EXCLUSIVE{{/exclusiveMaximum}}{{^exclusiveMaximum}}INCLUSIVE{{/exclusiveMaximum}})
  {{/vendorExtensions.x-has-min-max}}{{#vendorExtensions.x-has-min-max-items}}@ru.tinkoff.kora.validation.common.annotation.Size(min = {{minItems}}, max = {{maxItems}})
  {{/vendorExtensions.x-has-min-max-items}}{{#vendorExtensions.x-has-min-max-length}}@ru.tinkoff.kora.validation.common.annotation.Size(min = {{minLength}}, max = {{maxLength}})
  {{/vendorExtensions.x-has-min-max-length}}{{#vendorExtensions.x-has-pattern}}@ru.tinkoff.kora.validation.common.annotation.Pattern("{{{pattern}}}")
  {{/vendorExtensions.x-has-pattern}}{{#vendorExtensions.x-has-valid-model}}@ru.tinkoff.kora.validation.common.annotation.Valid
  {{/vendorExtensions.x-has-valid-model}}
{{^isDiscriminator}}{{#isOverridden}}override {{/isOverridden}}{{/isDiscriminator}}val {{name}}: {{^vendorExtensions.x-json-nullable}}{{{datatypeWithEnum}}}? = null{{/vendorExtensions.x-json-nullable}}{{#vendorExtensions.x-json-nullable}}ru.tinkoff.kora.json.common.JsonNullable<{{{datatypeWithEnum}}}>{{/vendorExtensions.x-json-nullable}}{{^-last}},{{/-last}}
{{/optionalVars}}){{#vendorExtensions.x-discriminator-value}} : {{parent}} {{/vendorExtensions.x-discriminator-value}} {
{{#vendorExtensions.x-discriminator-constant}}

  companion object {
    val DISCRIMINATOR: String = {{{vendorExtensions.x-discriminator-constant}}}
  }
{{/vendorExtensions.x-discriminator-constant}}
{{#vendorExtensions.x-discriminator-constants}}

    {{#vendorExtensions.formParamMappers}}
    private ru.tinkoff.kora.http.client.common.writer.StringParameterConverter<{{paramType}}> {{paramName}}Converter;
    {{/vendorExtensions.formParamMappers}}

  companion object {
    val DISCRIMINATORS: List = listOf({{{vendorExtensions.x-discriminator-constants}}})
    {{#vendorExtensions.x-discriminator-constant-fields}}
    val DISCRIMINATOR_{{discriminatorField}}: String = {{{discriminatorValue}}}
    {{/vendorExtensions.x-discriminator-constant-fields}}
  }
{{/vendorExtensions.x-discriminator-constants}}

{{#vendorExtensions.x-discriminator-values-check}}
  init {
    if {{{vendorExtensions.x-discriminator-values-check}}} {
      throw IllegalStateException("Invalid discriminator value");
    }
  }
{{/vendorExtensions.x-discriminator-values-check}}

{{^hasVars}}
  override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (javaClass != other?.javaClass) return false
    return true
  }

  override fun hashCode(): Int {
    return javaClass.hashCode()
  }
{{/hasVars}}

  {{#allVars}}
      {{#isEnum}}
      {{^isContainer}}
  {{>kotlinEnumClass}}
      {{/isContainer}}
      {{#isContainer}}
      {{#mostInnerItems}}
  {{>kotlinEnumClass}}
      {{/mostInnerItems}}
      {{/isContainer}}
      {{/isEnum}}
  {{/allVars}}
}

{{/discriminator}}
{{/isEnum}}
{{/model}}
{{/models}}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy