@Test public void usesRefForStructureMembers() { StructureShape baz = StructureShape.builder() .id("foo.bar#Baz") .addMember("bam", ShapeId.from("foo.bar#Bam")) .build(); StructureShape bam = StructureShape.builder() .id("foo.bar#Bam") .build(); Model model = Model.builder().addShapes(baz, bam).build(); RefStrategy ref = RefStrategy .createDefaultStrategy(model, new JsonSchemaConfig(), propertyNamingStrategy); assertThat(ref.toPointer(baz.getMember("bam").get().getId()), equalTo("#/definitions/Bam")); }
@Override public String toPointer(ShapeId id) { if (id.getMember().isPresent()) { MemberShape member = model.expectShape(id, MemberShape.class); return createMemberPointer(member); } return rootPointer + stripNonAlphaNumericCharsIfNecessary(id.getName()); }
DefaultRefStrategy implements RefStrategy { @Override public String toPointer(ShapeId id) { if (id.getMember().isPresent()) { MemberShape member = model.expectShape(id, MemberShape.class); return createMemberPointer(member); } return rootPointer + stripNonAlphaNumericCharsIfNecessary(id.getName()); } }
DefaultRefStrategy implements RefStrategy { @Override public String toPointer(ShapeId id) { if (id.getMember().isPresent()) { MemberShape member = model.expectShape(id, MemberShape.class); return createMemberPointer(member); } return rootPointer + stripNonAlphaNumericCharsIfNecessary(id.getName()); } DefaultRefStrategy(Model model, JsonSchemaConfig config, PropertyNamingStrategy propertyNamingStrategy); }
DefaultRefStrategy implements RefStrategy { @Override public String toPointer(ShapeId id) { if (id.getMember().isPresent()) { MemberShape member = model.expectShape(id, MemberShape.class); return createMemberPointer(member); } return rootPointer + stripNonAlphaNumericCharsIfNecessary(id.getName()); } DefaultRefStrategy(Model model, JsonSchemaConfig config, PropertyNamingStrategy propertyNamingStrategy); @Override String toPointer(ShapeId id); @Override boolean isInlined(Shape shape); }
DefaultRefStrategy implements RefStrategy { @Override public String toPointer(ShapeId id) { if (id.getMember().isPresent()) { MemberShape member = model.expectShape(id, MemberShape.class); return createMemberPointer(member); } return rootPointer + stripNonAlphaNumericCharsIfNecessary(id.getName()); } DefaultRefStrategy(Model model, JsonSchemaConfig config, PropertyNamingStrategy propertyNamingStrategy); @Override String toPointer(ShapeId id); @Override boolean isInlined(Shape shape);  }