From 0685b2c05d10afc903d189871eaef369ca207e3e Mon Sep 17 00:00:00 2001 From: Beppe Catanese Date: Mon, 28 Mar 2022 09:44:23 +0200 Subject: [PATCH] Add test with booleans --- .../swagger/v3/core/converting/PojoTest.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java index 0c8be930a2..65863f5ee7 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java @@ -704,4 +704,50 @@ public void setId(String id) { } } + @Test + public void testModelWithBoolean() { + + String yaml = "ClassWithBoolean:\n" + + " required:\n" + + " - booleanObject\n" + + " - booleanType\n" + + " type: object\n" + + " properties:\n" + + " booleanObject:\n" + + " type: boolean\n" + + " description: my Boolean object field\n" + + " booleanType:\n" + + " type: boolean\n" + + " description: my boolean type field\n"; + SerializationMatchers.assertEqualsToYaml(read(ClassWithBoolean.class), yaml); + + } + + @Schema + static class ClassWithBoolean { + + @Schema(required = true, description = "my Boolean object field") + private Boolean booleanObject; + + @Schema(required = true, description = "my boolean type field") + private boolean booleanType; + + public Boolean getBooleanObject() { + return booleanObject; + } + + public void setBooleanObject(Boolean booleanObject) { + this.booleanObject = booleanObject; + } + + public boolean getBooleanType() { + return booleanType; + } + + public void setBooleanType(boolean booleanType) { + this.booleanType = booleanType; + } + } + + }