Skip to content
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

Added Workflow to verify ambassaor.json schema #758

Merged
merged 52 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
61b331d
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
d4ccdfa
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
37a16c5
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
7004de4
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
bc0301f
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
baaae11
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
724a856
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
60bd8dc
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
5c9dfc7
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
b24135b
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
261511e
Create blank.yml
ramishj Jun 19, 2024
9c34895
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
56635fb
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
a21cd44
Create Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
7a99bb6
Delete .github/workflows/validate-ambassadors.yml
ramishj Jun 19, 2024
4d37b38
Delete .github/workflows/blank.yml
ramishj Jun 19, 2024
5edf727
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
a6a6fcc
Merge branch 'main' of https://github.com/ramishj/community
ramishj Jun 19, 2024
6f4bf57
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
f3b9cd0
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
e7a58bc
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
cb707ad
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
83ee27d
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
8dc36ca
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
bf66dc5
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
86ce0d8
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
7a9bd19
Update Validate Ambassadors JSON.yml
ramishj Jun 19, 2024
a472f6a
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
05c338e
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
4e5f49f
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
46b51e6
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
50b9097
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
48ec5b8
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
7d3c563
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
5573ee3
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
8025764
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
10bd026
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
c880b3e
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
91d6af8
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
1aca772
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
3cb88ac
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
d4c2655
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
880f5f7
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
0110c60
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
a1c5369
Added Workflow to verify ambassaor.json schema
ramishj Jun 19, 2024
fa09281
Update .github/workflows/Validate Ambassadors JSON.yml
ramishj Jun 21, 2024
9adb1a8
Update ambassadors-schema.json
ramishj Jun 21, 2024
8a440dd
Update Validate Ambassadors JSON.yml
ramishj Jun 21, 2024
762d2d1
add mastodon optional property
benjagm Jun 23, 2024
2e4d8b9
Update Validate Ambassadors JSON.yml
ramishj Jun 24, 2024
96d0586
Update Validate Ambassadors JSON.yml
ramishj Jun 24, 2024
4b668fb
Update Validate Ambassadors JSON.yml
ramishj Jun 24, 2024
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
60 changes: 60 additions & 0 deletions .github/workflows/Validate Ambassadors JSON.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Validate Ambassadors JSON

on:
push:
paths:
- 'programs/ambassadors/ambassadors.json'
pull_request:
paths:
- 'programs/ambassadors/ambassadors.json'

jobs:
validate-json:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Dependencies
run: npm install ajv ajv-formats

- name: Validate ambassadors.json
run: |
node -e "
const Ajv = require('ajv');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run the validation against a 2020-12 schema the dependency to use is: ajv/dist/2020

Right now the action is failing:
https://github.com/json-schema-org/community/actions/runs/9631882401

const addFormats = require('ajv-formats');
const path = require('path');
const fs = require('fs');

const ambassadorsDir = path.join(process.env.GITHUB_WORKSPACE, 'programs', 'ambassadors');
const schemaPath = path.join(ambassadorsDir, 'ambassadors-schema.json');
const dataPath = path.join(ambassadorsDir, 'ambassadors.json');

try {
const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf-8'));
const data = JSON.parse(fs.readFileSync(dataPath, 'utf-8'));

const ajv = new Ajv({ allErrors: true });
addFormats(ajv);

const validate = ajv.compile(schema);
const valid = validate(data);

if (!valid) {
console.error('Validation failed:', validate.errors);
process.exit(1);
} else {
console.log('ambassadors.json is valid.');
}
} catch (error) {
console.error('Error validating ambassadors.json:', error);
process.exit(1);
}"


96 changes: 96 additions & 0 deletions programs/ambassadors/ambassadors-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
benjagm marked this conversation as resolved.
Show resolved Hide resolved
"description": "Array of contributor profiles",
"items": {
"type": "object",
"description": "Contributor profile",
"properties": {
"name": {
"type": "string",
"description": "Full name of the contributor"
},
"img": {
"type": "string",
"format": "uri",
"description": "URL to the contributor's profile image"
},
"bio": {
"type": "string",
"description": "Brief biography of the contributor"
},
"title": {
"type": "string",
"description": "Professional title of the contributor"
},
"github": {
"type": "string",
"description": "GitHub profile URL of the contributor"
},
"twitter": {
"type": "string",
"description": "Twitter profile URL of the contributor"
},
"mastodon": {
"type": "string",
"description": "Mastodon profile URL of the contributor"
},
"linkedin": {
"type": "string",
"description": "LinkedIn profile URL of the contributor"
},
"company": {
"type": "string",
"description": "Company where the contributor works"
},
"country": {
"type": "string",
"description": "Country where the contributor is based"
},
"contributions": {
"type": "array",
"description": "List of contributions made by the contributor",
"items": {
"type": "object",
"description": "Details of a specific contribution",
"properties": {
"type": {
"type": "string",
"enum": ["article", "talk", "video", "other", "book", "paper", "initiative", "project", "working group"],
"description": "Type of the contribution"
},
"title": {
"type": "string",
"description": "Title of the contribution"
},
"date": {
"type": "object",
"description": "Date of the contribution",
"properties": {
"year": {
"type": "integer",
"minimum": 1900,
"maximum": 2100,
"description": "Year of the contribution"
},
"month": {
"type": "string",
"enum": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
"description": "Month of the contribution"
}
},
"required": ["year", "month"]
},
"link": {
"type": "string",
"format": "uri",
"description": "URL link to the contribution"
}
},
"required": ["type", "title", "date", "link"]
}
}
},
"required": ["name", "img", "bio", "title", "github", "company", "country", "contributions"]
}
}
44 changes: 22 additions & 22 deletions programs/ambassadors/ambassadors.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"name": "I am the first Ambassador",
"img": "https://avatars.githubusercontent.com/u/40007659?v=4",
"bio": "I am the first JSON Schema Ambassador. I work as Schema Designer in ACME since 2002 and I am the implementer of the Turbo Implementation.",
"title": "Schema Designer at ACME",
"github": "iamthefirst",
"twitter": "iamthefirst",
"linkedin": "iamthefirst",
"company": "ACME",
"country": "🇺🇸",
"contributions": [
{
"type": "article",
"title": "Title of my first contribution",
"date": {
"year": 2024,
"month": "May"
},
"link": "link-to-my-contribution"
}
]
}
{
"name": "I am the first Ambassador",
"img": "https://avatars.githubusercontent.com/u/40007659?v=4",
"bio": "I am the first JSON Schema Ambassador. I work as Schema Designer in ACME since 2002 and I am the implementer of the Turbo Implementation.",
"title": "Schema Designer at ACME",
"github": "iamthefirst",
"twitter": "iamthefirst",
"linkedin": "iamthefirst",
"company": "ACME",
"country": "🇺🇸",
"contributions": [
{
"type": "article",
"title": "Title of my first contribution",
"date": {
"year": 2024,
"month": "May"
},
"link": "https://github.com/my-contri"
}
]
}
]
Loading