Interface JsonSchemaClassPathResourceLoader


public interface JsonSchemaClassPathResourceLoader
API to retrieve a JSON Schema for a class.
Since:
1.7.0
  • Field Details

  • Method Details

    • createDefault

      static @NonNull JsonSchemaClassPathResourceLoader createDefault(@NonNull ClassLoader classLoader)
      Create a default JsonSchemaClassPathResourceLoader for the given ClassLoader.

      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

      <T> Optional<String> jsonSchemaStringForClass(@NonNull Class<T> type)
      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 with JsonSchema. 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

      default @NonNull Map<String, io.micronaut.core.io.Readable> 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