Record Class JsonSchemaContext

java.lang.Object
java.lang.Record
io.micronaut.jsonschema.visitor.context.JsonSchemaContext
Record Components:
outputLocation - The location where JSON schemas will be generated inside the build META-INF/ directory.
baseUrl - The base URI to be used for schemas.
binaryAsArray - Whether to encode byte array as a JSON array. The default and preferred behavior is to encode it as a Base64 string.
draft - An enum for JSON Schema draft versions. Currently only 2020-12 draft is supported.
strictMode - Whether to generate schemas in strict mode. In strict mode unresolved properties in JSON will cause an error. All the properties that are not annotated as nullable must be non-null.
createdSchemasByType - A cache of crated schemas
currentOriginatingElements - The originating elements for the current schema

public record JsonSchemaContext(String outputLocation, String baseUrl, boolean binaryAsArray, JsonSchemaContext.JsonSchemaDraft draft, boolean strictMode, Map<String,Schema> createdSchemasByType, List<io.micronaut.inject.ast.ClassElement> currentOriginatingElements) extends Record
A context with configuration for the JSON schema.
  • Field Details

  • Constructor Details

    • JsonSchemaContext

      public JsonSchemaContext(String outputLocation, String baseUrl, boolean binaryAsArray, JsonSchemaContext.JsonSchemaDraft draft, boolean strictMode, Map<String,Schema> createdSchemasByType, List<io.micronaut.inject.ast.ClassElement> currentOriginatingElements)
      Creates an instance of a JsonSchemaContext record class.
      Parameters:
      outputLocation - the value for the outputLocation record component
      baseUrl - the value for the baseUrl record component
      binaryAsArray - the value for the binaryAsArray record component
      draft - the value for the draft record component
      strictMode - the value for the strictMode record component
      createdSchemasByType - the value for the createdSchemasByType record component
      currentOriginatingElements - the value for the currentOriginatingElements record component
  • Method Details

    • getParameters

      public static Set<String> getParameters()
    • createDefault

      public static JsonSchemaContext createDefault(Map<String,String> options)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • outputLocation

      public String outputLocation()
      Returns the value of the outputLocation record component.
      Returns:
      the value of the outputLocation record component
    • baseUrl

      public String baseUrl()
      Returns the value of the baseUrl record component.
      Returns:
      the value of the baseUrl record component
    • binaryAsArray

      public boolean binaryAsArray()
      Returns the value of the binaryAsArray record component.
      Returns:
      the value of the binaryAsArray record component
    • draft

      Returns the value of the draft record component.
      Returns:
      the value of the draft record component
    • strictMode

      public boolean strictMode()
      Returns the value of the strictMode record component.
      Returns:
      the value of the strictMode record component
    • createdSchemasByType

      public Map<String,Schema> createdSchemasByType()
      Returns the value of the createdSchemasByType record component.
      Returns:
      the value of the createdSchemasByType record component
    • currentOriginatingElements

      public List<io.micronaut.inject.ast.ClassElement> currentOriginatingElements()
      Returns the value of the currentOriginatingElements record component.
      Returns:
      the value of the currentOriginatingElements record component