diff --git a/elide-swagger/src/main/java/com/yahoo/elide/swagger/models/media/Resource.java b/elide-swagger/src/main/java/com/yahoo/elide/swagger/models/media/Resource.java index 4f2cefe9cb..927fe8523e 100644 --- a/elide-swagger/src/main/java/com/yahoo/elide/swagger/models/media/Resource.java +++ b/elide-swagger/src/main/java/com/yahoo/elide/swagger/models/media/Resource.java @@ -5,6 +5,7 @@ */ package com.yahoo.elide.swagger.models.media; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; @@ -46,10 +47,12 @@ public void addRelationship(String relationshipName, Relationship relationship) relationships.addProperty(relationshipName, new Data(relationship)); } + @JsonIgnore public ObjectSchema getAttributes() { return this.attributes; } + @JsonIgnore public ObjectSchema getRelationships() { return this.relationships; } diff --git a/elide-swagger/src/test/java/com/yahoo/elide/swagger/OpenApiIT.java b/elide-swagger/src/test/java/com/yahoo/elide/swagger/OpenApiIT.java index 29aff1891c..83279a4148 100644 --- a/elide-swagger/src/test/java/com/yahoo/elide/swagger/OpenApiIT.java +++ b/elide-swagger/src/test/java/com/yahoo/elide/swagger/OpenApiIT.java @@ -48,8 +48,21 @@ void testDocumentFetchJson() throws Exception { assertTrue(node.get("paths").size() > 1); assertNotNull(node.get("paths").get("/book")); assertNotNull(node.get("paths").get("/publisher")); + assertNotNull(node.get("components").get("schemas").get("book")); + assertEquals(4, node.get("components").get("schemas").get("book").size()); + assertNotNull(node.get("components").get("schemas").get("book").get("title")); + assertNotNull(node.get("components").get("schemas").get("book").get("type")); + assertNotNull(node.get("components").get("schemas").get("book").get("properties")); + assertNotNull(node.get("components").get("schemas").get("book").get("description")); + assertNotNull(node.get("components").get("schemas").get("publisher")); + assertEquals(4, node.get("components").get("schemas").get("publisher").size()); + assertNotNull(node.get("components").get("schemas").get("publisher").get("title")); + assertNotNull(node.get("components").get("schemas").get("publisher").get("type")); + assertNotNull(node.get("components").get("schemas").get("publisher").get("properties")); + assertNotNull(node.get("components").get("schemas").get("publisher").get("description")); + } @Test