Skip to content

Commit

Permalink
Merge pull request #3793 from JetBrains/ktl-1171-universites-validation
Browse files Browse the repository at this point in the history
KTL-1171 A comma in the YAML value broke entire page
  • Loading branch information
nikpachoo authored Sep 20, 2023
2 parents 5fb195b + def7bd9 commit 95f62f7
Show file tree
Hide file tree
Showing 6 changed files with 746 additions and 654 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/validate-universites-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Validate universities

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
validate_universities_data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: chrisdickinson/setup-yq@latest
with:
yq-version: 'v4.9.5'
- run: |
jsonschema -i <(yq eval --tojson -j data/universities.yml) data/schemas/universities.json
echo "Universities data is valid!"
50 changes: 50 additions & 0 deletions data/schemas/universities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"location": {
"type": "string"
},
"courses": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"url": {
"type": [
"string",
"null"
],
"format": "uri"
}
},
"required": ["name", "url"],
"additionalProperties": false
}
},
"geo": {
"type": "object",
"properties": {
"lat": {
"type": "number"
},
"lng": {
"type": "number"
}
},
"required": ["lat", "lng"],
"additionalProperties": false
}
},
"required": ["title", "location", "courses", "geo"],
"additionalProperties": false
}
}
Loading

0 comments on commit 95f62f7

Please sign in to comment.