-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
458 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# TypeSchema | ||
|
||
## Tests | ||
|
||
This directory contains test TypeSchema specifications using different features of the specification. | ||
If you want to build a generator or parser it is recommended to test your library against these tests. | ||
Your generator is level 5 compliant in case it can work with all levels of the specification. | ||
|
||
## Level 1 | ||
|
||
Tests whether it is possible to work with a simple structures. It tests also that it is possible to | ||
reference a different struct. This is the most basic feature which every processor should support. | ||
|
||
## Level 2 | ||
|
||
Tests whether it is possible to use array and map data types. Inline means that the native array/map | ||
data types are used. Array and map definition types result in a custom array or map implementation. | ||
|
||
## Level 3 | ||
|
||
Tests whether it is possible to extend a struct. If supported a generator should produce two classes | ||
with an actual extend. | ||
|
||
## Level 4 | ||
|
||
Tests whether it is possible to use generics. Generic placeholder at a struct can be replaced on usage | ||
with actual types. A generator should produce actual generics if the language supports this. | ||
|
||
## Level 5 | ||
|
||
Tests whether it is possible to use discriminated union. Through a discriminated union it is possible | ||
to use different schemas depending on a discriminated type value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"description": "A student struct with an assigned faculty", | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"faculty": { | ||
"type": "reference", | ||
"target": "Faculty" | ||
} | ||
} | ||
}, | ||
"Faculty": { | ||
"type": "struct", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "array", | ||
"schema": { | ||
"type": "reference", | ||
"target": "Student_Property" | ||
} | ||
} | ||
} | ||
}, | ||
"Student_Property": { | ||
"type": "struct", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "array", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "reference", | ||
"target": "Student_Array_Reference" | ||
} | ||
} | ||
}, | ||
"Student_Array_Reference": { | ||
"type": "array", | ||
"schema": { | ||
"type": "reference", | ||
"target": "Student_Property" | ||
} | ||
}, | ||
"Student_Property": { | ||
"type": "struct", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "reference", | ||
"target": "Student_Array_String" | ||
} | ||
} | ||
}, | ||
"Student_Array_String": { | ||
"type": "array", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "map", | ||
"schema": { | ||
"type": "reference", | ||
"target": "Student_Property" | ||
} | ||
} | ||
} | ||
}, | ||
"Student_Property": { | ||
"type": "struct", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "map", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "reference", | ||
"target": "Student_Map_Reference" | ||
} | ||
} | ||
}, | ||
"Student_Map_Reference": { | ||
"type": "map", | ||
"schema": { | ||
"type": "reference", | ||
"target": "Student_Property" | ||
} | ||
}, | ||
"Student_Property": { | ||
"type": "struct", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"definitions": { | ||
"Student": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
}, | ||
"properties": { | ||
"type": "reference", | ||
"target": "Student_Map_String" | ||
} | ||
} | ||
}, | ||
"Student_Map_String": { | ||
"type": "map", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"definitions": { | ||
"Human": { | ||
"type": "struct", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
}, | ||
"age": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"Student": { | ||
"parent": { | ||
"type": "reference", | ||
"target": "Human" | ||
}, | ||
"type": "struct", | ||
"properties": { | ||
"studentId": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"root": "Student" | ||
} |
Oops, something went wrong.