@Test public void stripsNonAlphanumericCharactersWhenRequested() { JsonSchemaConfig config = new JsonSchemaConfig(); config.setAlphanumericOnlyRefs(true); RefStrategy ref = RefStrategy .createDefaultStrategy(Model.builder().build(), config, propertyNamingStrategy); String pointer = ref.toPointer(ShapeId.from("smithy.example#Foo_Bar")); assertThat(pointer, equalTo("#/definitions/FooBar")); }
@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);  }