Class JsonSchemaNaming
java.lang.Object
io.micronaut.jsonschema.naming.JsonSchemaNaming
The naming of the JSON schemas generated for
JsonSchema types.
The annotation processor names the generated META-INF/<outputLocation>/<name>.schema.json files and
their $id with these methods, and the runtime uses the same methods to find the schema of a type.
- Since:
- 2.3.2
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcamelCaseToKebabCase(String value) Convert from camel case to kebab case, skipping the dots between the names of nested types.static StringdefaultBaseUri(String outputLocation) The default base URI of the schemas:classpath:META-INF/<outputLocation>, so that the$refs between generated schemas resolve from the classpath.static StringThe path of a schema file inside the output location.static StringThe$idof a schema.static booleanisAbsolute(String uri) Whether a schema URI is absolute.static StringsimpleName(Class<?> type) The simple name of a class including the names of the classes it is nested in, for exampleOuter$Inner, as the annotation processor sees it.static StringThe title of a schema.static StringThe URI of a schema, relative to the base URI unless theurimember of the annotation is absolute.
-
Field Details
-
SUFFIX
-
CLASSPATH_SCHEME
The scheme of the default base URI, which NetworkNT and other validators resolve from the classpath.- See Also:
-
META_INF
-
-
Method Details
-
defaultBaseUri
The default base URI of the schemas:classpath:META-INF/<outputLocation>, so that the$refs between generated schemas resolve from the classpath.- Parameters:
outputLocation- The location of the schemas inside theMETA-INF/directory- Returns:
- The base URI, without a trailing slash
-
title
The title of a schema.- Parameters:
title- The title of theJsonSchemaannotation, if anysimpleName- The simple name of the type, where nested types are separated by$or., for exampleOuter$Inner- Returns:
- The title
-
simpleName
-
uri
The URI of a schema, relative to the base URI unless theurimember of the annotation is absolute.- Parameters:
title- The title of the schema, seetitle(String, String)uri- The URI of theJsonSchemaannotation, if any- Returns:
- The URI
-
id
The$idof a schema.- Parameters:
uri- The URI of the schema, seeuri(String, String)baseUri- The base URI, if any- Returns:
- The
$id
-
isAbsolute
Whether a schema URI is absolute.- Parameters:
uri- The URI- Returns:
- Whether it is absolute
-
fileName
The path of a schema file inside the output location.- Parameters:
id- The$idor the URI of the schemabaseUri- The base URI, if knownoutputLocation- The location of the schemas inside theMETA-INF/directory- Returns:
- The path, for example
llama.schema.json
-
camelCaseToKebabCase
-