Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit f331bf8

Browse files
committed
Uses intsAllowedForFloatDoubleFormats in Float/Double schemas
1 parent 2ef5e38 commit f331bf8

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ class DoubleJsonSchema {
2222

2323
class DoubleJsonSchema1 private constructor() : JsonSchema<DoubleJsonSchema1Boxed>(
2424
JsonSchemaInfo()
25+
{{#if generatorSettings.intsAllowedForFloatDoubleFormats}}
26+
.type(setOf(
27+
Integer::class.java,
28+
Long::class.java,
29+
Float::class.java,
30+
Double::class.java
31+
))
32+
{{else}}
2533
.type(setOf(Double::class.java))
34+
{{/if}}
2635
.format("double")
2736
), NumberSchemaValidator<DoubleJsonSchema1BoxedNumber> {
2837
@Throws(ValidationException::class)

src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ class FloatJsonSchema {
2222

2323
class FloatJsonSchema1 private constructor() : JsonSchema<FloatJsonSchema1Boxed>(
2424
JsonSchemaInfo()
25+
{{#if generatorSettings.intsAllowedForFloatDoubleFormats}}
26+
.type(setOf(
27+
Integer::class.java,
28+
Float::class.java
29+
))
30+
{{else}}
2531
.type(setOf(Float::class.java))
32+
{{/if}}
2633
.format("float")
2734
), NumberSchemaValidator<FloatJsonSchema1BoxedNumber> {
2835
@Throws(ValidationException::class)

0 commit comments

Comments
 (0)