public final class JsonSchemaConverter extends java.lang.Object implements ToSmithyBuilder<JsonSchemaConverter>
Modifier and Type | Class and Description |
---|---|
static class |
JsonSchemaConverter.Builder |
Modifier and Type | Method and Description |
---|---|
static JsonSchemaConverter.Builder |
builder() |
SchemaDocument |
convert()
Perform the conversion of the entire shape index.
|
SchemaDocument |
convertShape(Shape shape)
Perform the conversion of a single shape.
|
JsonSchemaConfig |
getConfig()
Gets the configuration object.
|
boolean |
isInlined(Shape shape)
Checks if the given shape is inlined into its container when targeted
by a member.
|
boolean |
isTopLevelPointer(java.lang.String pointer)
Checks if the given JSON pointer points to a top-level definition.
|
void |
setConfig(JsonSchemaConfig config)
Set the JSON Schema configuration settings.
|
JsonSchemaConverter.Builder |
toBuilder()
Take this object and create a builder that contains all of the
current property values of this object.
|
java.lang.String |
toPointer(ToShapeId id)
Given a shape ID, returns the value used in a $ref to refer to it.
|
java.lang.String |
toPropertyName(MemberShape member)
Gets the property naming strategy of the converter.
|
public static JsonSchemaConverter.Builder builder()
public JsonSchemaConfig getConfig()
public void setConfig(JsonSchemaConfig config)
config
- Config object to set.public java.lang.String toPropertyName(MemberShape member)
member
- Member to convert to a property name.public java.lang.String toPointer(ToShapeId id)
The return value is expected to be a JSON pointer.
id
- Shape ID to convert to a $ref string.public boolean isTopLevelPointer(java.lang.String pointer)
Note that this expects the pointer to exactly start with the same
string that is configured as JsonSchemaConfig.getDefinitionPointer()
,
or the default value of "#/definitions". If the number of segments
in the provided pointer is also equal to the number of segments
in the default pointer + 1, then it is considered a top-level pointer.
pointer
- Pointer to check.public boolean isInlined(Shape shape)
shape
- Shape to check.public SchemaDocument convert()
public SchemaDocument convertShape(Shape shape)
The root shape of the created document is set to the given shape. No schema extensions are added to the converted schema. This conversion also doesn't take the shape predicate or private controls into account.
shape
- Shape to convert.public JsonSchemaConverter.Builder toBuilder()
ToSmithyBuilder
toBuilder
in interface ToSmithyBuilder<JsonSchemaConverter>