From c9af0d28f57786e0591d639520456458b9f33b36 Mon Sep 17 00:00:00 2001 From: Taha El Amine Kassabi Date: Tue, 15 Sep 2026 18:24:55 +0200 Subject: [PATCH] fix: require MonetaryAmount properties Mark amount and currency as required because the JSR 354 supplier contracts guarantee both values are non-null. Update the OpenAPI 3.0 and 3.1 fixtures accordingly. Co-Authored-By: Codex GPT-5 --- .../springdoc/core/converters/models/MonetaryAmount.java | 4 ++-- .../src/test/resources/results/3.0.1/app114.json | 4 ++++ .../src/test/resources/results/3.1.0/app114.json | 6 +++++- .../src/test/resources/results/3.0.1/app114.json | 4 ++++ .../src/test/resources/results/3.1.0/app114.json | 6 +++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java index 245b0b827d..7c48535842 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/models/MonetaryAmount.java @@ -43,14 +43,14 @@ public class MonetaryAmount { * The Amount. */ @JsonProperty("amount") - @Schema(example = "99.96") + @Schema(example = "99.96", requiredMode = Schema.RequiredMode.REQUIRED) private BigDecimal amount; /** * The Currency. */ @JsonProperty("currency") - @Schema(example = "USD") + @Schema(example = "USD", requiredMode = Schema.RequiredMode.REQUIRED) private String currency; } diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app114.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app114.json index 9a8e3b05d8..f57d283e84 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app114.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app114.json @@ -53,6 +53,10 @@ } }, "MonetaryAmount": { + "required": [ + "amount", + "currency" + ], "type": "object", "properties": { "amount": { diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app114.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app114.json index abd416fb2e..28341dadff 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app114.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app114.json @@ -63,7 +63,11 @@ "type": "string", "example": "USD" } - } + }, + "required": [ + "amount", + "currency" + ] } } } diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app114.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app114.json index d7a3f07926..c9ed35c304 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app114.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app114.json @@ -63,6 +63,10 @@ "description": "The type Car dto." }, "MonetaryAmount": { + "required": [ + "amount", + "currency" + ], "type": "object", "properties": { "amount": { diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app114.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app114.json index 6055c1cb24..c00c891e78 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app114.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app114.json @@ -74,7 +74,11 @@ "type": "string", "example": "USD" } - } + }, + "required": [ + "amount", + "currency" + ] } } }