Skip to content

Commit

Permalink
Remove attributes and relationships from swagger components (#3229) (#…
Browse files Browse the repository at this point in the history
…3230)

Co-authored-by: Gavin Matthews <[email protected]>
  • Loading branch information
bladedancer and gmatthewsAxway authored Jun 22, 2024
1 parent 62423d6 commit 29a605d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
13 changes: 13 additions & 0 deletions elide-swagger/src/test/java/com/yahoo/elide/swagger/OpenApiIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 29a605d

Please sign in to comment.