Skip to content

Commit

Permalink
Add some better Schema examples
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Mar 28, 2023
1 parent 1da06bc commit af1c201
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Installation/Schema/example.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
{
"$id": "https://opencatalogi.nl/example.schema.json",
"$schema": "https://docs.commongateway.nl/schemas/Entity.schema.json",
"version": "0.1",
"version": "0.2",
"title": "Example",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
"description": "The person's first name.",
"example": "John"
},
"lastName": {
"type": "string",
"description": "The person's last name."
"description": "The person's last name.",
"example": "Doe"
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
"description": "Age in years which must be equal to or greater than zero.",
"example": 25,
"minimum": 18
},
"relationExample": {
"description": "An example of a relation to another Schema",
"example": "{ \"postalCode\": \"1234AB\", \"notes\": [\"note1\", \"note2\"] }",
"$ref": "https://opencatalogi.nl/schema/relationExample.schema.json"
},
"relationExamples": {
"type": "array",
"description": "An example of an array of objects",
"items": {
"$ref": "https://opencatalogi.nl/schema/relationExample.schema.json"
}
}
}
}
23 changes: 23 additions & 0 deletions Installation/Schema/relationExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$id": "https://opencatalogi.nl/schema/relationExample.schema.json",
"$schema": "https://docs.commongateway.nl/schemas/Entity.schema.json",
"version": "0.1",
"title": "RelationExample",
"type": "object",
"properties": {
"postalCode": {
"type": "string",
"description": "A dutch PostalCode.",
"example": "1234AB",
"minLength": 6,
"maxLength": 6
},
"notes": {
"type": "array",
"description": "An example of an array of strings",
"items": {
"type": "string"
}
}
}
}

0 comments on commit af1c201

Please sign in to comment.