HACKER Q&A
📣 redlizard

Example of your favorite CSV Schema Documentation?


I've been working on an interface that accepts csv, and have been struggling to find good examples of services that have solid definitions of acceptable schema (column names, types, Required/Optional/Constriants).

I'd also be interested in examples that have documented nested arrays, nested objects, or nested object arrays in csv.

I've been thinking about it alot since openAPI/GQL really do solve documentation, and can even autogen from views, but i haven't found something similar for CSV.


  👤 redlizard Accepted Answer ✓
Ok, after a decent amount of research all i can really find is: https://digital-preservation.github.io/csv-schema/#toc4

Not in love. Doesn't really handle nested arrays/ objects. Also doesn't generate human readable documentation.

Worried I may have to roll my own :(, but this feels like it is a solved problem.

Breaking it down into 3 sections:

1. Schema Definition 2. Documentation (Autogenerated from schema) 3. Deserialization that applies type constraints and validation

I'd be happy with the first 2 and to take care of deserialization myself. Something with all three rolled into one would be lovely.

The major requirement i haven't been able to find support for are nested objects or arrays in a csv.

Example header: firstname, lastname, contact_0, contact_1, contact_2, address.address_1.1, address.address_2.1, address.zip.1, address.state.1, address.address_1.2, address.address_2.2, address.zip.2, address.state.2,


👤 not_your_vase
I don't know about a lotbof CSV schema defs, but I found the column definitions in SQLLoader's control files quite intuitive.