Interface SchemaDefinitionNamingStrategy
-
- All Superinterfaces:
StatefulConfig
- All Known Implementing Classes:
CleanSchemaDefinitionNamingStrategy
,DefaultSchemaDefinitionNamingStrategy
public interface SchemaDefinitionNamingStrategy extends StatefulConfig
Naming strategy for the keys in the "definitions"/"$defs" containing shared/reused subschemas.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
adjustDuplicateNames(Map<DefinitionKey,String> subschemasWithDuplicateNames, SchemaGenerationContext generationContext)
Adjust the names/keys in the "definitions"/"$defs" for the given definition references that have the same names (according togetDefinitionNameForKey(DefinitionKey, SchemaGenerationContext)
) to ensure their uniqueness.default String
adjustNullableName(DefinitionKey key, String definitionName, SchemaGenerationContext generationContext)
Provide an alternative definition name for the given key and name when it is nullable.String
getDefinitionNameForKey(DefinitionKey key, SchemaGenerationContext generationContext)
Getter for the name/key in the "definitions"/"$defs" to represent the givenDefinitionKey
.-
Methods inherited from interface com.github.victools.jsonschema.generator.StatefulConfig
resetAfterSchemaGenerationFinished
-
-
-
-
Method Detail
-
getDefinitionNameForKey
String getDefinitionNameForKey(DefinitionKey key, SchemaGenerationContext generationContext)
Getter for the name/key in the "definitions"/"$defs" to represent the givenDefinitionKey
.- Parameters:
key
- definition reference for a type (there may be multiple different keys for the same type if custom definitions are involved)generationContext
- generation context providing access to the applied configuration and type context- Returns:
- name/key in "definitions"/"$defs" for the indicated subschema
- See Also:
SchemaGenerationContext.getGeneratorConfig()
,SchemaGenerationContext.getTypeContext()
-
adjustDuplicateNames
default void adjustDuplicateNames(Map<DefinitionKey,String> subschemasWithDuplicateNames, SchemaGenerationContext generationContext)
Adjust the names/keys in the "definitions"/"$defs" for the given definition references that have the same names (according togetDefinitionNameForKey(DefinitionKey, SchemaGenerationContext)
) to ensure their uniqueness.
By default, a numeric counter is appended after a separating dash to each duplicate name.- Parameters:
subschemasWithDuplicateNames
- definition references that initially have the same values that should be adjustedgenerationContext
- generation context providing access to the applied configuration and type context- See Also:
getDefinitionNameForKey(DefinitionKey, SchemaGenerationContext)
-
adjustNullableName
default String adjustNullableName(DefinitionKey key, String definitionName, SchemaGenerationContext generationContext)
Provide an alternative definition name for the given key and name when it is nullable.
By default, a"-nullable"
suffix will be appended.- Parameters:
key
- definition reference for a type (there may be multiple different keys for the same type if custom definitions are involved)definitionName
- previous result ofgetDefinitionNameForKey(DefinitionKey, SchemaGenerationContext)
to be adjustedgenerationContext
- generation context providing access to the applied configuration and type context- Returns:
- adjusted definition name
-
-