Skip to content

chore: Add json yaml validate workflow #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/json-yaml-validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: JSON YAML Validate

on:
pull_request:
paths:
- 'web/list.json'
- 'web/template.json'
workflow_dispatch:

permissions:
contents: read
pull-requests: write

jobs:
json-yaml-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: validate example meta
uses: GrantBirki/json-yaml-validate@v3.2.1
with:
comment: 'true'
files:
./web/list.json
json_schema: ./web/template.json
94 changes: 82 additions & 12 deletions web/template.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,84 @@
{
"caseTitle": "Example",
"caseDesc": "A brief description of what this example demonstrates.",
"tags": ["BSC", "opBNB"],
"github": "GitHub repository link for this example.",
"replit": "Replit repository link for this example.",
"video": {
"type": "ype of video source (e.g., youtube, file).",
"link": "URL link to the video."
},
"guide": "Additional guide document link.",
"otherLink": "Link to related resource or external page.",
"imgUrl": "URL of the thumbnail image."
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Example Meta Schema",
"description": "A JSON Schema for validating an array of example metadata objects.",
"type": "array",
"items": {
"type": "object",
"properties": {
"caseTitle": {
"type": "string",
"description": "The title of the case/example."
},
"caseDesc": {
"type": "string",
"description": "A brief description of the case/example."
},
"tags": {
"type": "array",
"description": "An array of tags associated with the case.",
"items": {
"type": "string"
}
},
"github": {
"type": "string",
"description": "GitHub repository link for the example."
},
"replit": {
"type": "string",
"description": "Replit repository link for the example."
},
"video": {
"type": "object",
"description": "Video metadata can be empty or if used must include both 'type' and 'link'.",
"anyOf": [
{
"maxProperties": 0
},
{
"required": [
"type",
"link"
],
"properties": {
"type": {
"type": "string",
"description": "The video source type (e.g., youtube, file)."
},
"link": {
"type": "string",
"description": "The URL link to the video."
}
},
"additionalProperties": false
}
]
},
"guide": {
"type": "string",
"description": "Link to additional guide resources."
},
"otherLink": {
"type": "string",
"description": "Link to a related resource or external page."
},
"imgUrl": {
"type": "string",
"description": "URL of the thumbnail image."
}
},
"required": [
"caseTitle",
"caseDesc",
"tags",
"github",
"replit",
"video",
"guide",
"otherLink",
"imgUrl"
],
"additionalProperties": false
}
}