public class SchemaCleanUpUtils extends Object
Constructor and Description |
---|
SchemaCleanUpUtils(SchemaGeneratorConfig config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
ensureDefinitionKeyIsPlain(String definitionKey)
Replace characters in the given definition key that are neither alphanumeric nor a dot, dash or underscore (as expected by OpenAPI).
|
String |
ensureDefinitionKeyIsUriCompatible(String definitionKey)
Replace characters in the given definition key that are deemed incompatible within a URI (as expected by JSON Schema).
|
void |
reduceAllOfNodes(List<com.fasterxml.jackson.databind.node.ObjectNode> jsonSchemas)
Remove and merge
SchemaKeyword.TAG_ALLOF parts when there are no conflicts between the sub-schemas. |
void |
reduceAnyOfNodes(List<com.fasterxml.jackson.databind.node.ObjectNode> jsonSchemas)
Reduce nested
SchemaKeyword.TAG_ANYOF parts when one contains an entry with only another SchemaKeyword.TAG_ANYOF inside. |
public SchemaCleanUpUtils(SchemaGeneratorConfig config)
config
- configuration to be appliedpublic void reduceAllOfNodes(List<com.fasterxml.jackson.databind.node.ObjectNode> jsonSchemas)
SchemaKeyword.TAG_ALLOF
parts when there are no conflicts between the sub-schemas. This makes for more readable
schemas being generated but has the side-effect that any manually added SchemaKeyword.TAG_ALLOF
(e.g. through a custom definition of
attribute overrides) may be removed as well if it isn't strictly speaking necessary.jsonSchemas
- generated schemas that may contain unnecessary SchemaKeyword.TAG_ALLOF
nodespublic void reduceAnyOfNodes(List<com.fasterxml.jackson.databind.node.ObjectNode> jsonSchemas)
SchemaKeyword.TAG_ANYOF
parts when one contains an entry with only another SchemaKeyword.TAG_ANYOF
inside. This
makes for more readable schemas being generated but has the side-effect that any manually added SchemaKeyword.TAG_ANYOF
(e.g. through a
custom definition of attribute overrides) may be removed as well if it isn't strictly speaking necessary.jsonSchemas
- generated schemas that may contain unnecessary nested SchemaKeyword.TAG_ANYOF
nodespublic String ensureDefinitionKeyIsUriCompatible(String definitionKey)
definitionKey
- SchemaDefinitionNamingStrategy
outputpublic String ensureDefinitionKeyIsPlain(String definitionKey)
definitionKey
- SchemaDefinitionNamingStrategy
outputCopyright © 2022 VicTools. All rights reserved.