Record Class JsonFileSourceConfig
- Record Components:
path- the JSON file path, resolved against the connector's base directory; must not be null or blankrecords- optional path to the array of records within the document; must not be null (useOptional.empty())references- the declared column references; may be empty
- All Implemented Interfaces:
SourceConfig
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 Summary
ConstructorsConstructorDescriptionJsonFileSourceConfig(String path, Optional<String> records) Creates a config with no declared references.JsonFileSourceConfig(String path, Optional<String> records, List<ColumnReference> references) Canonical constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.records()Returns the value of therecordsrecord component.Returns the value of thereferencesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JsonFileSourceConfig
public JsonFileSourceConfig(String path, Optional<String> records, List<ColumnReference> references) Canonical constructor.- Throws:
NullPointerException- if any component is nullIllegalArgumentException- ifpathis blank
-
JsonFileSourceConfig
Creates a config with no declared references.
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
records
Returns the value of therecordsrecord component.- Returns:
- the value of the
recordsrecord component
-
references
Returns the value of thereferencesrecord component.- Returns:
- the value of the
referencesrecord component
-