
kotlin.validations_2.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-kotlin-schema-codegen Show documentation
Show all versions of json-kotlin-schema-codegen Show documentation
Code generation from JSON Schema to Kotlin or Java
{{#type}}{{#DATE_TIME}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isDateTime({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format date-time - ${{&kotlinName}}" }
{{/DATE_TIME}}{{#DATE}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isDate({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format date - ${{&kotlinName}}" }
{{/DATE}}{{#TIME}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isTime({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format time - ${{&kotlinName}}" }
{{/TIME}}{{#UUID}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isUUID({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format uuid - ${{&kotlinName}}" }
{{/UUID}}{{#URI}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isURI({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format uri - ${{&kotlinName}}" }
{{/URI}}{{#URI_REFERENCE}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isURIReference({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format uri-reference - ${{&kotlinName}}" }
{{/URI_REFERENCE}}{{#EMAIL}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isEmail({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format email - ${{&kotlinName}}" }
{{/EMAIL}}{{#HOSTNAME}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isHostname({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format hostname - ${{&kotlinName}}" }
{{/HOSTNAME}}{{#IPV4}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isIPV4({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format ipv4 - ${{&kotlinName}}" }
{{/IPV4}}{{#IPV6}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isIPV6({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format ipv6 - ${{&kotlinName}}" }
{{/IPV6}}{{#DURATION}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isDuration({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format duration - ${{&kotlinName}}" }
{{/DURATION}}{{#JSON_POINTER}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isJSONPointer({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format json-pointer - ${{&kotlinName}}" }
{{/JSON_POINTER}}{{#RELATIVE_JSON_POINTER}}{{&indent}} require({{#negate}}!{{/negate}}JSONValidation.isRelativeJSONPointer({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} format relative-json-pointer - ${{&kotlinName}}" }
{{/RELATIVE_JSON_POINTER}}{{#PATTERN}}{{&indent}} require({{#negate}}!{{/negate}}{{&value.staticName}}.containsMatchIn({{&kotlinName}})) { "{{&displayName}} {{^negate}}does not match{{/negate}}{{#negate}}matches{{/negate}} pattern ${{&value.staticName}} - ${{&kotlinName}}" }
{{/PATTERN}}{{#MAXIMUM_INT}}{{&indent}} require({{&kotlinName}} {{>cond_le}} {{&value}}) { "{{&displayName}} {{#negate}}not {{/negate}}> maximum {{&value}} - ${{&kotlinName}}" }
{{/MAXIMUM_INT}}{{#MAXIMUM_LONG}}{{&indent}} require({{&kotlinName}} {{>cond_le}} {{&value}}L) { "{{&displayName}} {{#negate}}not {{/negate}}> maximum {{&value}} - ${{&kotlinName}}" }
{{/MAXIMUM_LONG}}{{#MINIMUM_INT}}{{&indent}} require({{&kotlinName}} {{>cond_ge}} {{&value}}) { "{{&displayName}} {{#negate}}not {{/negate}}< minimum {{&value}} - ${{&kotlinName}}" }
{{/MINIMUM_INT}}{{#MINIMUM_LONG}}{{&indent}} require({{&kotlinName}} {{^negate}}>= {{/negate}}{{#negate}}< {{/negate}}{{&value}}L) { "{{&displayName}} {{#negate}}not {{/negate}}< minimum {{&value}} - ${{&kotlinName}}" }
{{/MINIMUM_LONG}}{{#MAXIMUM_DECIMAL}}{{&indent}} require({{&kotlinName}} {{>cond_le}} {{&value.staticName}}) { "{{&displayName}} {{#negate}}not {{/negate}}> maximum {{&value.value}} - ${{&kotlinName}}" }
{{/MAXIMUM_DECIMAL}}{{#MAXIMUM_DECIMAL_ZERO}}{{&indent}} require({{&kotlinName}} {{>cond_le}} BigDecimal.ZERO) { "{{&displayName}} {{#negate}}not {{/negate}}> maximum 0 - ${{&kotlinName}}" }
{{/MAXIMUM_DECIMAL_ZERO}}{{#EXCLUSIVE_MAXIMUM_DECIMAL}}{{&indent}} require({{&kotlinName}} {{>cond_lt}} {{&value.staticName}}) { "{{&displayName}} {{#negate}}not {{/negate}}>= exclusive maximum {{&value.value}} - ${{&kotlinName}}" }
{{/EXCLUSIVE_MAXIMUM_DECIMAL}}{{#EXCLUSIVE_MAXIMUM_DECIMAL_ZERO}}{{&indent}} require({{&kotlinName}} {{>cond_lt}} BigDecimal.ZERO) { "{{&displayName}} {{#negate}}not {{/negate}}>= exclusive maximum 0 - ${{&kotlinName}}" }
{{/EXCLUSIVE_MAXIMUM_DECIMAL_ZERO}}{{#MINIMUM_DECIMAL}}{{&indent}} require({{&kotlinName}} {{>cond_ge}} {{&value.staticName}}) { "{{&displayName}} {{#negate}}not {{/negate}}< minimum {{&value.value}} - ${{&kotlinName}}" }
{{/MINIMUM_DECIMAL}}{{#MINIMUM_DECIMAL_ZERO}}{{&indent}} require({{&kotlinName}} {{>cond_ge}} BigDecimal.ZERO) { "{{&displayName}} {{#negate}}not {{/negate}}< minimum 0 - ${{&kotlinName}}" }
{{/MINIMUM_DECIMAL_ZERO}}{{#EXCLUSIVE_MINIMUM_DECIMAL}}{{&indent}} require({{&kotlinName}} {{>cond_gt}} {{&value.staticName}}) { "{{&displayName}} {{#negate}}not {{/negate}}<= exclusive minimum {{&value.value}} - ${{&kotlinName}}" }
{{/EXCLUSIVE_MINIMUM_DECIMAL}}{{#EXCLUSIVE_MINIMUM_DECIMAL_ZERO}}{{&indent}} require({{&kotlinName}} {{>cond_gt}} BigDecimal.ZERO) { "{{&displayName}} {{#negate}}not {{/negate}}<= exclusive minimum 0 - ${{&kotlinName}}" }
{{/EXCLUSIVE_MINIMUM_DECIMAL_ZERO}}{{#RANGE_DECIMAL}}{{&indent}} require({{&kotlinName}} {{#negate}}!{{/negate}}in {{&value.first.staticName}}..{{&value.second.staticName}}) { "{{&displayName}} {{^negate}}not {{/negate}}in range {{#value}}{{&first.value}}..{{&second.value}}{{/value}} - ${{&kotlinName}}" }
{{/RANGE_DECIMAL}}{{#RANGE_INT}}{{&indent}} require({{&kotlinName}} {{#negate}}!{{/negate}}in {{#value}}{{&first}}..{{&second}}{{/value}}) { "{{&displayName}} {{^negate}}not {{/negate}}in range {{#value}}{{&first}}..{{&second}}{{/value}} - ${{&kotlinName}}" }
{{/RANGE_INT}}{{#RANGE_LONG}}{{&indent}} require({{&kotlinName}} {{#negate}}!{{/negate}}in {{#value}}{{&first}}L..{{&second}}L{{/value}}) { "{{&displayName}} {{^negate}}not {{/negate}}in range {{#value}}{{&first}}..{{&second}}{{/value}} - ${{&kotlinName}}" }
{{/RANGE_LONG}}{{#MULTIPLE_INT}}{{&indent}} require({{&kotlinName}}.rem({{&value}}) {{>cond_eq}} 0) { "{{&displayName}} {{^negate}}not {{/negate}}a multiple of {{&value}} - ${{&kotlinName}}" }
{{/MULTIPLE_INT}}{{#MULTIPLE_LONG}}{{&indent}} require({{&kotlinName}}.rem({{&value}}L) {{>cond_eq}} 0L) { "{{&displayName}} {{^negate}}not {{/negate}}a multiple of {{&value}} - ${{&kotlinName}}" }
{{/MULTIPLE_LONG}}{{#MULTIPLE_DECIMAL}}{{&indent}} require({{&kotlinName}}.rem({{&value.staticName}}).compareTo(BigDecimal.ZERO) {{>cond_eq}} 0) { "{{&displayName}} {{^negate}}not {{/negate}}a multiple of {{&value.value}} - ${{&kotlinName}}" }
{{/MULTIPLE_DECIMAL}}{{#MAX_ITEMS}}{{&indent}} require({{&kotlinName}}.size {{>cond_le}} {{&value}}) { "{{&displayName}} length {{#negate}}not {{/negate}}> maximum {{&value}} - ${{&openBrace}}{{&kotlinName}}.size}" }
{{/MAX_ITEMS}}{{#MIN_ITEMS}}{{&indent}} require({{&kotlinName}}.{{#value}}{{#isOne}}is{{^negate}}Not{{/negate}}Empty(){{/isOne}}{{^isOne}}size {{>cond_ge}} {{&rawNumber}}{{/isOne}}{{/value}}) { "{{&displayName}} length {{#negate}}not {{/negate}}< minimum {{&value}} - ${{&openBrace}}{{&kotlinName}}.size}" }
{{/MIN_ITEMS}}{{#CONST_ITEMS}}{{&indent}} require({{&kotlinName}}.size {{>cond_eq}} {{&value}}) { "{{&displayName}} length {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value {{&value}} - ${{&openBrace}}{{&kotlinName}}.size}" }
{{/CONST_ITEMS}}{{#RANGE_ITEMS}}{{&indent}} require({{&kotlinName}}.size {{#negate}}!{{/negate}}in {{#value}}{{&first}}..{{&second}}{{/value}}) { "{{&displayName}} length {{^negate}}not {{/negate}}in range {{#value}}{{&first}}..{{&second}}{{/value}} - ${{&openBrace}}{{&kotlinName}}.size}" }
{{/RANGE_ITEMS}}{{#MAX_LENGTH}}{{&indent}} require({{&kotlinName}}.length {{>cond_le}} {{&value}}) { "{{&displayName}} length {{#negate}}not {{/negate}}> maximum {{&value}} - ${{&openBrace}}{{&kotlinName}}.length}" }
{{/MAX_LENGTH}}{{#MIN_LENGTH}}{{&indent}} require({{&kotlinName}}.{{#value}}{{#isOne}}is{{^negate}}Not{{/negate}}Empty(){{/isOne}}{{^isOne}}length {{>cond_ge}} {{&rawNumber}}{{/isOne}}{{/value}}) { "{{&displayName}} length {{#negate}}Not{{/negate}}< minimum {{&value}} - ${{&openBrace}}{{&kotlinName}}.length}" }
{{/MIN_LENGTH}}{{#CONST_LENGTH}}{{&indent}} require({{&kotlinName}}.{{#value}}length {{>cond_eq}} {{&rawNumber}}{{/value}}) { "{{&displayName}} length {{^negate}}!={{/negate}}{{#negate}}=={{/negate}} constant {{&value}} - ${{&openBrace}}{{&kotlinName}}.length}" }
{{/CONST_LENGTH}}{{#RANGE_LENGTH}}{{&indent}} require({{&kotlinName}}.{{#value}}length {{#negate}}!{{/negate}}in {{&first}}..{{&second}}{{/value}}) { "{{&displayName}} length {{^negate}}not {{/negate}}in range {{#value}}{{&first}}..{{&second}}{{/value}} - ${{&openBrace}}{{&kotlinName}}.length}" }
{{/RANGE_LENGTH}}{{#CONST_STRING}}{{&indent}} require({{&kotlinName}} {{>cond_eq}} {{&value.staticName}}) { "{{&displayName}} {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value ${{&value.staticName}} - ${{&kotlinName}}" }
{{/CONST_STRING}}{{#CONST_INT}}{{&indent}} require({{&kotlinName}} {{>cond_eq}} {{&value}}) { "{{&displayName}} {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value {{&value}} - ${{&kotlinName}}" }
{{/CONST_INT}}{{#CONST_LONG}}{{&indent}} require({{&kotlinName}} == {{&value}}L) { "{{&displayName}} not constant value {{&value}} - ${{&kotlinName}}" }
{{/CONST_LONG}}{{#CONST_DECIMAL}}{{&indent}} require({{&kotlinName}}.compareTo({{&value.staticName}}) {{>cond_eq}} 0) { "{{&displayName}} {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value {{&value.value}} - ${{&kotlinName}}" }
{{/CONST_DECIMAL}}{{#CONST_DECIMAL_ZERO}}{{&indent}} require({{&kotlinName}}.compareTo(BigDecimal.ZERO) {{>cond_eq}} 0) { "{{&displayName}} {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value 0 - ${{&kotlinName}}" }
{{/CONST_DECIMAL_ZERO}}{{#CONST_ENUM}}{{&indent}} require({{&kotlinName}} {{>cond_eq}} {{&value.kotlinString}}) { "{{&displayName}} {{^negate}}not{{/negate}}{{#negate}}is{{/negate}} constant value {{&value.value}} - ${{&kotlinName}}" }
{{/CONST_ENUM}}{{#ENUM_STRING}}{{&indent}} require({{&kotlinName}} {{#negate}}!{{/negate}}in {{&value.staticName}}) { "{{&displayName}} {{^negate}}not {{/negate}}in enumerated values - ${{&kotlinName}}" }
{{/ENUM_STRING}}{{#ENUM_INT}}{{&indent}} require({{&kotlinName}} {{#negate}}!{{/negate}}in {{&value.staticName}}) { "{{&displayName}} {{^negate}}not {{/negate}}in enumerated values - ${{&kotlinName}}" }
{{/ENUM_INT}}{{#ARRAY_ITEMS}}{{&indent}} for ({{&arrayItems.kotlinName}} in {{&kotlinName}}){{#arrayItems}}{{#indent.increment}}{{#validations}}{{!
}}{{#first}}{{^last}} {{&openBrace}}{{/last}}
{{#nullable}}{{&indent}} if ({{&kotlinName}} != null){{^last}} {{&openBrace}}{{/last}}
{{#indent.increment}}{{>validations_2}}{{/indent.increment}}{{/nullable}}{{!
}}{{^nullable}}{{>validations_2}}{{/nullable}}{{/first}}{{!
}}{{^first}}{{#nullable}}{{#indent.increment}}{{>validations_2}}{{/indent.increment}}{{/nullable}}{{^nullable}}{{>validations_2}}{{/nullable}}{{!
}}{{#last}}{{#nullable}}{{&indent}} }
{{/nullable}}{{&indent}} }
{{/last}}{{/first}}{{/validations}}{{/indent.increment}}{{/arrayItems}}{{/ARRAY_ITEMS}}{{/type}}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy