{
"definitions": {
"Student": {
"description": "A simple student struct",
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
"root": "Student"
}
package TypeSchema
// A simple student struct
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
}
{
"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"
}
package TypeSchema
type Human struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
}
package TypeSchema
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
StudentId string `json:"studentId"`
}
{
"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"
}
package TypeSchema
// A student struct with an assigned faculty
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
Faculty *Faculty `json:"faculty"`
}
package TypeSchema
type Faculty struct {
Name string `json:"name"`
}
{
"definitions": {
"Student": {
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"type": "map",
"schema": {
"type": "string"
}
}
}
}
},
"root": "Student"
}
package TypeSchema
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
Properties map[string]string `json:"properties"`
}
{
"definitions": {
"Human": {
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"location": {
"type": "reference",
"target": "Location"
}
}
},
"Location": {
"type": "struct",
"base": true,
"properties": {
"type": {
"type": "string"
}
},
"discriminator": "type",
"mapping": {
"Web": "web",
"World": "world"
}
},
"Web": {
"parent": {
"type": "reference",
"target": "Location"
},
"type": "struct",
"properties": {
"url": {
"type": "string"
}
}
},
"World": {
"parent": {
"type": "reference",
"target": "Location"
},
"type": "struct",
"properties": {
"lat": {
"type": "string"
},
"long": {
"type": "string"
}
}
}
},
"root": "Human"
}
package TypeSchema
type Human struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Location *Location `json:"location"`
}
package TypeSchema
type Location struct {
Type string `json:"type"`
}
package TypeSchema
type Web struct {
Type string `json:"type"`
Url string `json:"url"`
}
package TypeSchema
type World struct {
Type string `json:"type"`
Lat string `json:"lat"`
Long string `json:"long"`
}
{
"definitions": {
"Student": {
"type": "struct",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"type": "struct",
"parent": {
"type": "reference",
"target": "Map",
"template": {
"T": "Student"
}
}
},
"Map": {
"type": "struct",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"schema": {
"type": "generic",
"name": "T"
}
}
}
}
},
"root": "StudentMap"
}
package TypeSchema
type Student struct {
MatricleNumber int `json:"matricleNumber"`
}
package TypeSchema
type StudentMap struct {
TotalResults int `json:"totalResults"`
Entries []Student `json:"entries"`
}
package TypeSchema
type Map[T any] struct {
TotalResults int `json:"totalResults"`
Entries []T `json:"entries"`
}
{
"import": {
"my_ns": "file:///generic.json"
},
"definitions": {
"Faculty": {
"type": "struct",
"properties": {
"description": {
"type": "string"
},
"students": {
"type": "array",
"schema": {
"type": "reference",
"target": "my_ns:StudentMap"
}
}
}
}
},
"root": "Faculty"
}
package TypeSchema
type Faculty struct {
Description string `json:"description"`
Students []StudentMap `json:"students"`
}