openapi.templates.kora.javaModel.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-generator Show documentation
Show all versions of openapi-generator Show documentation
Kora openapi-generator module
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{package}};
import jakarta.annotation.Nullable;
{{#models}}
{{#model}}
{{#isEnum}}
{{>javaEnumClass}}
{{/isEnum}}
{{^isEnum}}
{{#discriminator}}
/**
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/
@ru.tinkoff.kora.common.annotation.Generated("openapi generator kora java")
@ru.tinkoff.kora.json.common.annotation.Json
@ru.tinkoff.kora.json.common.annotation.JsonDiscriminatorField("{{{propertyBaseName}}}")
public sealed interface {{classname}} permits {{#vendorExtensions.x-unique-mapped-models}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-unique-mapped-models}} {
{{#allVars}}{{^isDiscriminator}}
/**
* {{#description}}{{.}}{{/description}}{{^description}}{{name}}{{/description}}
*/
{{{datatypeWithEnum}}} {{name}}();
{{{classname}}} with{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}({{^required}}@jakarta.annotation.Nullable{{/required}} {{{datatypeWithEnum}}} {{name}});
{{/isDiscriminator}}{{/allVars}}
}
{{/discriminator}}
{{^discriminator}}
/**
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}{{#allVars}}
* @param {{name}} {{#description}}{{.}}{{/description}}{{^description}}{{name}}{{/description}}{{/allVars}}
*/
@ru.tinkoff.kora.common.annotation.Generated("openapi generator kora java")
@ru.tinkoff.kora.json.common.annotation.JsonWriter
{{#vendorExtensions.x-discriminator-value}}@ru.tinkoff.kora.json.common.annotation.JsonDiscriminatorValue({{{vendorExtensions.x-discriminator-value}}}){{/vendorExtensions.x-discriminator-value}}
{{#vendorExtensions.x-enable-validation}}@ru.tinkoff.kora.validation.common.annotation.Valid{{/vendorExtensions.x-enable-validation}}
public record {{classname}} (
{{#allVars}}
@ru.tinkoff.kora.json.common.annotation.JsonField("{{baseName}}"){{^required}}
@Nullable{{/required}}
{{#vendorExtensions.x-has-min-max}}@ru.tinkoff.kora.validation.common.annotation.Range(from = {{minimum}}, to = {{maximum}}, 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}}{{{datatypeWithEnum}}} {{name}}{{^-last}},{{/-last}}
{{/allVars}}){{#vendorExtensions.x-discriminator-value}} implements {{parent}} {{/vendorExtensions.x-discriminator-value}}{
{{#vendorExtensions.x-discriminator-constant}}
{{/vendorExtensions.x-discriminator-constant}}
{{#vendorExtensions.x-discriminator-constants}}
public static final java.util.List DISCRIMINATORS = java.util.List.of({{{vendorExtensions.x-discriminator-constants}}});
{{#vendorExtensions.x-discriminator-constant-fields}}
public static final String DISCRIMINATOR_{{discriminatorField}} = {{{discriminatorValue}}};
{{/vendorExtensions.x-discriminator-constant-fields}}
{{/vendorExtensions.x-discriminator-constants}}
{{#isArray}}
public static String schema = """
{{{items}}}
""";
{{/isArray}}
{{#additionalConstructor}}
public {{classname}}(
{{#requiredVars}}
{{{datatypeWithEnum}}} {{name}}{{^-last}},{{/-last}}
{{/requiredVars}} ) {
this({{#allVars}}{{#required}}{{name}}{{/required}}{{^required}}null{{/required}}{{^-last}}, {{/-last}}{{/allVars}});
}
{{/additionalConstructor}}
@ru.tinkoff.kora.json.common.annotation.JsonReader
public {{classname}} { {{#vendorExtensions.x-discriminator-values-check}}
if {{{vendorExtensions.x-discriminator-values-check}}} {
throw new IllegalStateException("Invalid discriminator value");
}
{{/vendorExtensions.x-discriminator-values-check}}
}
{{#allVars}}
{{#isEnum}}
{{^isContainer}}
{{>javaEnumClass}}
{{/isContainer}}
{{#isContainer}}
{{#mostInnerItems}}
{{>javaEnumClass}}
{{/mostInnerItems}}
{{/isContainer}}
{{/isEnum}}
{{/allVars}}
{{#allVars}}
{{#vendorExtensions.x-discriminator-value}}{{#isOverridden}} @Override
{{/isOverridden}}{{/vendorExtensions.x-discriminator-value}} public {{{classname}}} with{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}({{^required}}@Nullable{{/required}} {{{datatypeWithEnum}}} {{name}}) {
if (this.{{name}} == {{name}}) return this;
return new {{{classname}}}({{#allVars}}
{{name}}{{^-last}},{{/-last}}{{/allVars}}
);
}
{{/allVars}}
}
{{/discriminator}}
{{/isEnum}}
{{/model}}
{{/models}}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy