Skip to content

Commit

Permalink
feat: added json schemas for all models to improve dev experience
Browse files Browse the repository at this point in the history
  • Loading branch information
brittonhayes committed Aug 1, 2023
1 parent 80c2944 commit 624d9ca
Show file tree
Hide file tree
Showing 11 changed files with 417 additions and 8 deletions.
2 changes: 2 additions & 0 deletions fixtures/allegiances.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=../schema/allegiances.schema.json

- model: Allegiance
rows:
- id: stormcast_eternals
Expand Down
2 changes: 2 additions & 0 deletions fixtures/alliances.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=../schema/alliances.schema.json

- model: GrandAlliance
rows:
- id: order
Expand Down
2 changes: 2 additions & 0 deletions fixtures/cities.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=../schema/cities.schema.json

- model: City
rows:
- id: anvilgard
Expand Down
18 changes: 10 additions & 8 deletions fixtures/units.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# yaml-language-server: $schema=../schema/units.schema.json

- model: Unit
rows:
- id: lord_celestant
name: Lord-Celestant
grand_alliance: order
move: 5in
move: 5"
description: A mighty warrior and leader of the Stormcast Eternals, wielding a powerful weapon and inspiring nearby units.
save: 3
bravery: 9
Expand All @@ -24,25 +26,25 @@
magic: []
damage_table:
- wound_track_position: 0
move: 5in
move: 5"
min_wounds_suffered: 0
melee_weapons:
- name: Celestine Hammer
range: '1'
range: 1"
attacks: '4+'
to_hit: '3+'
to_wound: '3+'
rend: '-1'
damage: 'D3'
- name: Stormbound Blade
range: '1'
range: 1"
attacks: '1'
to_hit: '3+'
to_wound: '4+'
rend: '-1'
damage: '2'
- name: Great Claws
range: '1'
range: 1"
attacks: '2'
to_hit: '3+'
to_wound: '3+'
Expand All @@ -52,7 +54,7 @@
- id: liberators
name: Liberators
grand_alliance: order
move: 5in
move: 5"
description: Mighty warriors armed with powerful warhammers and shields, forming the backbone of the Stormcast Eternals forces.
save: 4
bravery: 7
Expand All @@ -71,11 +73,11 @@
magic: []
damage_table:
- wound_track_position: 0
move: 5in
move: 5"
min_wounds_suffered: 0
melee_weapons:
- name: Warhammer
range: '1'
range: 1"
attacks: '1+'
to_hit: '4+'
to_wound: '3+'
Expand Down
2 changes: 2 additions & 0 deletions fixtures/warscrolls.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=../schema/warscrolls.schema.json

- model: Warscroll
rows:
- id: helstorm_rocket_battery
Expand Down
51 changes: 51 additions & 0 deletions schema/allegiances.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$id": "https://aos-api.com/schema/allegiances.schema.json",
"title": "Allegiances",
"type": "array",
"items": {
"properties": {
"model": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z_]+$"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"grand_alliance": {
"type": "string",
"pattern": "^[a-z_]+$",
"enum": ["order", "chaos", "destruction", "death"]
},
"mortal_realm": {
"type": "string",
"pattern": "^[a-z_]+$",
"enum": [
"aqshy",
"azyr",
"chamon",
"ghur",
"ghyran",
"hysh",
"shyish",
"ulgu"
]
}
}
}
}
}
}
}
34 changes: 34 additions & 0 deletions schema/alliances.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$id": "https://aos-api.com/schema/alliances.schema.json",
"title": "Alliances",
"type": "array",
"items": {
"properties": {
"model": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z_]+$"
},
"name": {
"type": "string",
"description": "The name of the grand alliance."
},
"description": {
"type": "string",
"description": "A description of the grand alliance."
}
}
}
}
}
}
}
34 changes: 34 additions & 0 deletions schema/cities.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$id": "https://aos-api.com/schema/cities.schema.json",
"title": "Cities",
"type": "array",
"items": {
"properties": {
"model": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z_]+$"
},
"name": {
"type": "string",
"description": "The name of the city."
},
"description": {
"type": "string",
"description": "A description of the city."
}
}
}
}
}
}
}
34 changes: 34 additions & 0 deletions schema/strategies.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$id": "https://aos-api.com/schema/strategies.schema.json",
"title": "Strategies",
"type": "array",
"items": {
"properties": {
"model": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z_]+$"
},
"name": {
"type": "string",
"description": "The name of the Grand Strategy."
},
"description": {
"type": "string",
"description": "A description of the Grand Strategy."
}
}
}
}
}
}
}
Loading

0 comments on commit 624d9ca

Please sign in to comment.