Interface JsonSchemaClassPathResourceLoader
public interface JsonSchemaClassPathResourceLoader
API to retrieve a JSON Schema for a class.
- Since:
- 1.7.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull JsonSchemaClassPathResourceLoadercreateDefault(@NonNull ClassLoader classLoader) Create a defaultJsonSchemaClassPathResourceLoaderfor the givenClassLoader.jsonSchemaStringForClass(@NonNull Class<T> type) This method retrieves the JSON Schema for a class for which a JSON Schema was generated.
-
Field Details
-
CLASS_LOADER_REQUIRED
-
-
Method Details
-
createDefault
Create a defaultJsonSchemaClassPathResourceLoaderfor the givenClassLoader.This factory is intended for usage outside of the Micronaut DI framework (for example, CLI tools). It composes the built-in schema loaders that are normally registered as beans.
- Parameters:
classLoader- The classloader- Returns:
- The default loader
- Since:
- 2.1.0
-
jsonSchemaStringForClass
This method retrieves the JSON Schema for a class for which a JSON Schema was generated. Micronaut JSON Schema annotation processor generates a JSON Schema at compilation-time for classes annotated withJsonSchema. The generated JSON Schema, by default, is saved to META/schemas.- Type Parameters:
T- Type used to generate the JSON Schema- Parameters:
type- the class for which a JSON Schema was generated at compilation-time.- Returns:
- A JSON Schema
-
jsonSchemas
- Returns:
- A map of all available JSON schemas keyed by their location within the schema folder.
For example, for schemas generated by the Micronaut JSON Schema annotation processor the keys are paths relative to
META-INF/<outputLocation>/(e.g.product.schema.json).Implementations may return an empty map if bulk discovery is not supported for the underlying
ResourceLoader. - Since:
- 2.0.0
-