Record Class JsonFileSourceConfig

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.source.JsonFileSourceConfig
Record Components:
path - the JSON file path, resolved against the connector's base directory; must not be null or blank
records - optional path to the array of records within the document; must not be null (use Optional.empty())
references - the declared column references; may be empty
All Implemented Interfaces:
SourceConfig

public record JsonFileSourceConfig(String path, Optional<String> records, List<ColumnReference> references) extends Record implements SourceConfig
Transport configuration for a local JSON file source.

Unlike CsvFileSourceConfig or DatabaseSourceConfig, a JSON file source declares no schema: it is an open (schema-on-read) source whose rows are nested StructValue documents navigated by path at query time. This is the first source kind that exercises the open-schema machinery end to end.

Syntax


 source Docs from json("docs.json");                       // top-level array of objects
 source Docs from json("docs.json") { records: "data.items" };  // array at a nested path
 

records, when present, is a ValuePath-style path (relix-processor, which this module does not depend on, hence no link): "a.b[0].items" locating the array of record objects within the parsed document. When absent, the connector treats the top-level value as the record source: an array yields one row per element, a single object yields a single row.

An optional references: block declares foreign-key style relationships from this source's columns to other relations. Because a JSON source is open, its own referencing columns cannot be checked against a declared schema — they resolve dynamically — but the target relation and columns are validated as usual.

  • Constructor Details

  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • records

      public Optional<String> records()
      Returns the value of the records record component.
      Returns:
      the value of the records record component
    • references

      public List<ColumnReference> references()
      Returns the value of the references record component.
      Returns:
      the value of the references record component