ImportDataSchema

@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class ImportDataSchema(val name: String, val path: String, val visibility: DataSchemaVisibility = DataSchemaVisibility.IMPLICIT_PUBLIC, val normalizationDelimiters: CharArray = ['\t', ' ', '_'], val withDefaultPath: Boolean = true, val csvOptions: CsvOptions = CsvOptions(','), val jsonOptions: JsonOptions = JsonOptions(), val jdbcOptions: JdbcOptions = JdbcOptions(), val enableExperimentalOpenApi: Boolean = false)

Annotation preprocessing will generate a DataSchema interface from the data at path. Data must be of supported format: CSV, JSON, Apache Arrow, Excel, OpenAPI (Swagger) in YAML/JSON, JDBC. Generated data schema has properties inferred from data and a companion object with read method. read method is either readCSV or readJson that returns DataFrame<name>

Parameters

name

name of the generated interface

path

URL or relative path to data. If a path starts with a protocol (http, https, ftp, jdbc), it's considered a URL. Otherwise, it's treated as a relative path. By default, it will be resolved relatively to project dir, i.e. File(projectDir, path) You can configure it by passing dataframe.resolutionDir option to preprocessor, see https://kotlinlang.org/docs/ksp-quickstart.html#pass-options-to-processors

visibility

visibility of the generated interface.

normalizationDelimiters

if not empty, split property names by delimiters, lowercase parts and join to camel case. Set empty list to disable normalization

withDefaultPath

if true, generate defaultPath property to the data schema's companion object and make it default argument for a read method

csvOptions

options to parse CSV data. Not used when data is not Csv

jsonOptions

options to parse JSON data. Not used when data is not Json

jdbcOptions

options to parse data from a database via JDBC. Not used when data is not stored in the database

enableExperimentalOpenApi

Can be set to true to enable experimental OpenAPI 3.0.0 types support

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard