Skip to content

Commit

Permalink
Merge pull request #84 from mdupierreux/master
Browse files Browse the repository at this point in the history
Fixed JSON grammar
  • Loading branch information
BoD committed May 6, 2015
2 parents 21bddda + 3034cb5 commit 57ac828
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 54 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ These are self-explanatory so here is an example:
"databaseFileName": "example.db",
"databaseVersion": 1,
"enableForeignKeys": true,
"useAnnotations": true,
"useAnnotations": true
}
```

Expand Down Expand Up @@ -66,19 +66,19 @@ Here is a `person.json` file as an example:
"documentation": "First name of this person. For instance, John.",
"name": "first_name",
"type": "String",
"defaultValue": "John",
"defaultValue": "John"
},
{
"documentation": "Last name (a.k.a. Given name) of this person. For instance, Smith.",
"name": "last_name",
"type": "String",
"nullable": true,
"defaultValue": "Doe",
"defaultValue": "Doe"
},
{
"name": "age",
"type": "Integer",
"index": true,
"index": true
},
{
"name": "gender",
Expand All @@ -87,17 +87,17 @@ Here is a `person.json` file as an example:
"enumValues": [
"MALE",
"FEMALE",
{"OTHER": "Value to use when neither male nor female"},
{"OTHER": "Value to use when neither male nor female"}
],
"nullable": false,
},
"nullable": false
}
],

"constraints": [
{
"name": "unique_name",
"definition": "UNIQUE (first_name, last_name) ON CONFLICT REPLACE"
},
}
]
}
```
Expand Down Expand Up @@ -181,13 +181,13 @@ Here is an example of the syntax:
"nullable": false,
"foreignKey": {
"table": "team",
"onDelete": "CASCADE",
},
"onDelete": "CASCADE"
}
},
{
"name": "first_name",
"type": "String",
"nullable": false,
"nullable": false
},

(...)
Expand Down
2 changes: 1 addition & 1 deletion etc/sample/_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"databaseFileName": "sample.db",
"databaseVersion": 1,
"enableForeignKeys": true,
"useAnnotations": true,
"useAnnotations": true
}
6 changes: 3 additions & 3 deletions etc/sample/company.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"name": "name",
"type": "String",
"nullable": false,
"index": true,
"index": true
},
{
"documentation": "The full address of this company.",
"name": "address",
"type": "String",
"nullable": true,
"nullable": true
},
{
"documentation": "The serial number of this company.",
Expand All @@ -23,6 +23,6 @@
"table": "serial_number",
"onDelete": "CASCADE"
}
},
}
]
}
8 changes: 4 additions & 4 deletions etc/sample/manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{
"name": "title",
"type": "String",
"nullable": false,
"nullable": false
},
{
"name": "isbn",
"type": "String",
"nullable": false,
},
],
"nullable": false
}
]
}
24 changes: 12 additions & 12 deletions etc/sample/person.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
"documentation": "First name of this person. For instance, John.",
"name": "first_name",
"type": "String",
"nullable": false,
"nullable": false
},
{
"documentation": "Last name (a.k.a. Given name) of this person. For instance, Smith.",
"name": "last_name",
"type": "String",
"nullable": false,
"index": true,
"index": true
},
{
"name": "Age",
"type": "Integer",
"nullable": false,
"nullable": false
},
{
"name": "birth_date",
"type": "Date",
"nullable": true,
"nullable": true
},
{
"documentation": "If {@code true}, this person has blue eyes. Otherwise, this person doesn't have blue eyes.",
"name": "has_blue_eyes",
"type": "Boolean",
"nullable": false,
"defaultValue": "0",
"defaultValue": "0"
},
{
"name": "height",
"type": "Float",
"nullable": true,
"nullable": true
},
{
"name": "gender",
Expand All @@ -43,21 +43,21 @@
"enumValues": [
"MALE",
"FEMALE",
{"OTHER": "Value to use when neither male nor female"},
{"OTHER": "Value to use when neither male nor female"}
],
"nullable": false,
"nullable": false
},
{
"name": "country_code",
"type": "String",
"nullable": false,
},
"nullable": false
}
],

"constraints": [
{
"name": "unique_name",
"definition": "UNIQUE (first_name, last_name) ON CONFLICT REPLACE"
},
],
}
]
}
14 changes: 7 additions & 7 deletions etc/sample/person_team.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
"nullable": false,
"foreignKey": {
"table": "person",
"onDelete": "RESTRICT",
},
"onDelete": "RESTRICT"
}
},
{
"name": "team_id",
"type": "Long",
"nullable": false,
"foreignKey": {
"table": "team",
"onDelete": "RESTRICT",
},
},
"onDelete": "RESTRICT"
}
}
],
"constraints": [
{
"name": "unique_person_team",
"definition": "UNIQUE (person_id, team_id) ON CONFLICT REPLACE"
},
],
}
]
}
12 changes: 6 additions & 6 deletions etc/sample/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"name": "product_id",
"type": "Long",
"nullable": false,
"index": true,
"index": true
},
{
"name": "name",
"type": "String",
"nullable": false,
"nullable": false
},
{
"documentation": "Optional manual id.",
Expand All @@ -19,9 +19,9 @@
"nullable": true,
"foreignKey": {
"table": "manual",
"onDelete": "SET NULL",
},
},
"onDelete": "SET NULL"
}
}
],
"idField": ["product_id"],
"idField": ["product_id"]
}
6 changes: 3 additions & 3 deletions etc/sample/serial_number.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"documentation": "Unique id, first part.",
"name": "part0",
"type": "String",
"nullable": false,
"nullable": false
},
{
"documentation": "Unique id, second part.",
"name": "part1",
"type": "String",
"nullable": false,
},
"nullable": false
}
]
}
14 changes: 7 additions & 7 deletions etc/sample/team.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
"nullable": false,
"foreignKey": {
"table": "company",
"onDelete": "CASCADE",
},
"onDelete": "CASCADE"
}
},
{
"name": "name",
"type": "String",
"nullable": false,
"nullable": false
},
{
"documentation": "2 letter country code where this team operates.",
"name": "country_code",
"type": "String",
"nullable": false,
"nullable": false
},
{
"documentation": "The serial number of this team.",
Expand All @@ -30,13 +30,13 @@
"table": "serial_number",
"onDelete": "CASCADE"
}
},
}
],

"constraints": [
{
"name": "unique_name",
"definition": "UNIQUE (team__name) ON CONFLICT REPLACE"
},
],
}
]
}

0 comments on commit 57ac828

Please sign in to comment.