Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fstueber committed Jul 31, 2024
2 parents 6445437 + bfdd605 commit 7724eea
Show file tree
Hide file tree
Showing 11 changed files with 1,428 additions and 1,296 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Main features:

+ Easy schema definiton via JSON which can be validated against the [CSV Table Meta Schema](https://github.com/openpotato/csv-table-schema/tree/main/schemas/v0.1/schema.json).
+ Dedicated to the CSV format.
+ Supports the following data types: string, enum, enum-set, bool, int, float, date, time, date-time, json and xml.
+ Supports the following data types: string, enum, enum-set, boolean, integer, numeric, date, time, date-time, json and xml.
+ Supports CSV tables with ordered and unordered columns.
+ Supports CSV tables with or without header row.
+ Supports CSV dictionaries with key/value rows.
+ Supports unique key definitions for CSV tables
+ Supports CSV dictionaries with key/value rows.
+ Supports polimorphic CSV tables with different row types, distinguished by a discriminator in the first column

## Documentation

Expand Down
75 changes: 28 additions & 47 deletions samples/sample01a.csvts.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,53 @@
{
"version": "0.2",
"title": "CSV Table Schema for students",
"description": "A sample CSV Table Schema for students",
"$schema": "https://schemahub.openpotato.org/csv-table-schema/v0.1/schema.json",
"version": "0.3",
"title": "CSV Table Schema for courses",
"description": "A sample CSV Table Schema for courses",
"table": {
"name": "Students.csv",
"name": "Courses.csv",
"type": "unordered",
"language": "en",
"columns": [
{
"code": "id",
"name": "Id",
"description": "Unique id",
"type": "string",
"format": "uuid"
},
{
"name": "LastName",
"description": "Last name of the student",
"type": "string"
},
{
"name": "FirstName",
"description": "First name of the student",
"code": "title",
"name": "Title",
"description": "Course title",
"type": "string"
},
{
"name": "Gender",
"description": "Gender of the student",
"type": "enum",
"members": [
{
"value": "M",
"description": "Male"
},
{
"value": "F",
"description": "Female"
},
{
"value": "D",
"description": "Diverse"
}
],
"optional": true,
"nullable": true
"code": "startDate",
"name": "StartDate",
"description": "Start date of the course",
"type": "date-time",
"formats": [
"yyyy-MM-dd"
]
},
{
"name": "Birthdate",
"description": "Birthdate of the student",
"type": "date",
"code": "endDate",
"name": "EndDate",
"description": "End date of the course",
"type": "date-time",
"formats": [
"yyyy-MM-dd"
],
"optional": true,
"nullable": true
]
},
{
"name": "CourseList",
"description": "Array of course (see sample01b.scsv.json) references ",
"type": "json",
"schema": {
"uri": "json-id-array.json"
},
"optional": true,
"nullable": true
"code": "subjectId",
"name": "SubjectId",
"description": "Reference to subject (see sample02c.csv-schema.json)",
"type": "string"
}
],
"unqiueKeys": [
"uniqueKeys": [
[
"Id"
"id"
]
]
}
Expand Down
19 changes: 12 additions & 7 deletions samples/sample01b.csvts.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"version": "0.2",
"$schema": "https://schemahub.openpotato.org/csv-table-schema/v0.1/schema.json",
"version": "0.3",
"title": "CSV Table Schema for courses",
"description": "A sample CSV Table Schema for courses",
"table": {
"name": "Courses.csv",
"type": "unordered",
"language": "en",
"columns": [
{
"code": "id",
"name": "Id",
"description": "Unique id",
"type": "string",
"format": "uuid"
"type": "string"
},
{
"code": "title",
"name": "Title",
"description": "Course title",
"type": "string"
},
{
"code": "startDate",
"name": "StartDate",
"description": "Start date of the course",
"type": "date-time",
Expand All @@ -26,6 +30,7 @@
]
},
{
"code": "endDate",
"name": "EndDate",
"description": "End date of the course",
"type": "date-time",
Expand All @@ -34,15 +39,15 @@
]
},
{
"code": "subjectId",
"name": "SubjectId",
"description": "Reference to subject (see sample02c.csv-schema.json)",
"type": "string",
"format": "uuid"
"type": "string"
}
],
"unqiueKeys": [
"uniqueKeys": [
[
"Id"
"id"
]
]
}
Expand Down
14 changes: 9 additions & 5 deletions samples/sample01c.csvts.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
{
"version": "0.2",
"$schema": "https://schemahub.openpotato.org/csv-table-schema/v0.1/schema.json",
"version": "0.3",
"title": "CSV Table Schema for subjects",
"description": "A sample CSV Table Schema for subjects",
"table": {
"name": "Subjects.csv",
"type": "unordered",
"language": "en",
"columns": [
{
"code": "id",
"name": "Id",
"description": "Unique id",
"type": "string",
"format": "uuid"
"type": "string"
},
{
"code": "shortName",
"name": "ShortName",
"description": "Short name of subject",
"type": "string"
},
{
"code": "longName",
"name": "LongName",
"description": "Long name of subject",
"type": "string"
}
],
"unqiueKeys": [
"uniqueKeys": [
[
"Id"
"id"
]
]
}
Expand Down
9 changes: 3 additions & 6 deletions samples/sample02.csvts.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"version": "0.2",
"$schema": "https://schemahub.openpotato.org/csv-table-schema/v0.1/schema.json",
"version": "0.3",
"title": "CSV Table Schema for configuration",
"description": "A sample CSV Table Schema for configuration data",
"dictionary": {
"name": "Configuration.csv",
"language": "en",
"keys": [
{
"name": "TimeZone",
Expand All @@ -26,11 +28,6 @@
"yyyy-MM-dd"
]
}
],
"unqiueKeys": [
[
"Id"
]
]
}
}
57 changes: 57 additions & 0 deletions samples/sample03.csvts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://schemahub.openpotato.org/csv-table-schema/v0.1/schema.json",
"version": "0.3",
"title": "CSV Table Schema for a polymorphic table",
"description": "A sample CSV Table Schema for polymorphic data",
"tableSet": {
"name": "tableset.csv",
"language": "en",
"tables": [
{
"description": "List of countries",
"columns": [
{
"code": "country",
"description": "Discriminator for country row",
"type": "discriminator",
"values": [
{
"value": "co"
}
]
},
{
"code": "name",
"description": "Name of the country",
"type": "string"
},
{
"code": "continent",
"description": "Name of the continent",
"type": "string"
}
]
},
{
"description": "List of continents",
"columns": [
{
"code": "continent",
"description": "Discriminator for continent row",
"type": "discriminator",
"values": [
{
"value": "cn"
}
]
},
{
"code": "name",
"description": "Name of the continent",
"type": "string"
}
]
}
]
}
}
Loading

0 comments on commit 7724eea

Please sign in to comment.