Class GeneratorContext

java.lang.Object
io.micronaut.jsonschema.generator.utils.GeneratorContext

@Internal public final class GeneratorContext extends Object
An aggregator for storing and accessing definitions and oneOf relations from json schema. Saves a map of definition reference to TypeDef, Boolean (boolean value is true if the type is a class/interface object). Saves a map of oneOf objects to keep in track on inheriting objects.
Since:
1.3
Author:
Elif Kurtay
  • Constructor Details

    • GeneratorContext

      public GeneratorContext()
  • Method Details

    • isDefinitionClass

      public boolean isDefinitionClass(String key)
    • getDefinitionType

      public io.micronaut.sourcegen.model.TypeDef getDefinitionType(String key)
    • getOneOfsToGenerate

      public List<Map.Entry<String,Schema>> getOneOfsToGenerate()
    • hasDefinition

      public boolean hasDefinition(String key)
    • isInheriting

      public boolean isInheriting(String className)
    • addDefinition

      public void addDefinition(String key, Schema definition)
    • addDefinition

      public void addDefinition(String key, io.micronaut.sourcegen.model.TypeDef classDef, boolean isClass)
    • addTempDefinition

      public void addTempDefinition(String referringDef, String ref)
    • addOneOf

      public void addOneOf(String key)
    • addOneOf

      public void addOneOf(Schema oneOf)
    • clearAll

      public void clearAll()
    • enableJsonSchemaRecordsProfile

      public void enableJsonSchemaRecordsProfile()
      Enable generation behavior used by the JSON schema records pipeline.

      The records profile keeps the default generator path intact, but opts into pipeline-specific behavior such as generated @JsonSchema annotations, stricter diagnostics for unsupported discovered-schema constructs, record-safe nullability/boxing, local-reference fallbacks, and Oracle provider metadata handling.

    • setConfiguration

      public void setConfiguration(SourceGeneratorConfig configuration)
      Set the current configuration.
      Parameters:
      configuration - The configuration
    • getConfiguration

      public SourceGeneratorConfig getConfiguration()
      Get the current configuration.
      Returns:
      The configuration
    • warn

      public void warn(String code, String message)
      Record a non-fatal generation warning.
      Parameters:
      code - The machine-readable warning code
      message - The warning message
    • getWarnings

      public List<GeneratorContext.Warning> getWarnings()
      Get recorded warnings.
      Returns:
      The warnings
    • isAddGeneratedJsonSchemaAnnotation

      public boolean isAddGeneratedJsonSchemaAnnotation()
      Returns:
      Whether generated types should be annotated with @JsonSchema
    • isJsonSchemaRecordsProfile

      public boolean isJsonSchemaRecordsProfile()
      Returns:
      Whether record-generation profile behavior is enabled for unsupported/discovered-schema handling. This is not a general JSON Schema mode flag; it is set by enableJsonSchemaRecordsProfile() and scopes compatibility-sensitive behavior to the records pipeline.