diff --git a/modules/jooby-apitool/src/main/java/org/jooby/apitool/raml/Raml.java b/modules/jooby-apitool/src/main/java/org/jooby/apitool/raml/Raml.java index 7fc64652c6..8ba5cc75bd 100644 --- a/modules/jooby-apitool/src/main/java/org/jooby/apitool/raml/Raml.java +++ b/modules/jooby-apitool/src/main/java/org/jooby/apitool/raml/Raml.java @@ -487,7 +487,9 @@ private RamlType define(final String type, final Model model) { } })); definition = object; - object.setExample(example); + if (example.values().stream().filter(Objects::nonNull).count() > 0) { + object.setExample(example); + } } return definition; } diff --git a/modules/jooby-apitool/src/test/java/org/jooby/apitool/RamlTest.java b/modules/jooby-apitool/src/test/java/org/jooby/apitool/RamlTest.java index 56af6457b4..893732a575 100644 --- a/modules/jooby-apitool/src/test/java/org/jooby/apitool/RamlTest.java +++ b/modules/jooby-apitool/src/test/java/org/jooby/apitool/RamlTest.java @@ -60,8 +60,6 @@ public void shouldWorkWithUUID() throws Exception { + " type: object\n" + " properties:\n" + " id?: UUID\n" - + " example:\n" - + " id: null\n" + "/api:\n" + " /entry:\n" + " /{id}:\n" @@ -103,7 +101,6 @@ public void shouldUseCustomType() throws Exception { + " bar: string\n" + " UUID:\n" + " type: object\n" - + " example: {}\n" + "/api:\n" + " /entry:\n" + " /{id}:\n"