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

Publish an implementation metadata file suitable for use by json-schema.org #1408

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
59 changes: 57 additions & 2 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,64 @@ jobs:
with:
version: ${{ inputs.bowtie-version }}

- name: Generate implementations.json file
- name: Generate implementations.json file for private API
run: |
bowtie info $(bowtie filter-implementations | sed 's/^/-i /') --format json > implementations.json

- name: Create a directory structure for json-schema.org to access Implementations metadata file
run: mkdir -p api/v1/json-schema-org

- name: Generate implementations metadata file suitable for use by json-schema.org
run: |
bowtie filter-implementations | \
while read -r impl; do
bowtie info -i $impl --format json | \
jq --arg impl "$impl" --slurpfile dialects data/dialects.json '
. as $info |
{($info.source): (
{
id: $impl,
dialects: $info.dialects,
badges_urls: (
{
supported_versions: "https://bowtie.report/badges/\($info.language)-\($info.name)/supported_versions.json",
dialects_compliance: (
$info.dialects | map(
. as $uri |
$dialects[0] | map(select(.uri == $uri)) | .[0] |
{
(.shortName): "https://bowtie.report/badges/\($info.language)-\($info.name)/compliance/\(.shortName).json"
}
) | add
)
}
)
}
)}
'
done | \
jq -s 'add' > api/v1/json-schema-org/implementations

- name: Validate implementations metadata file generated for json-schema.org against its corresponding JSON Schema
run: |
VALIDATION=$(bowtie validate --expect valid -i python-jsonschema bowtie/schemas/api/v1/json-schema-org/implementations.json api/v1/json-schema-org/implementations)
SUMMARY=$(echo "$VALIDATION" | bowtie summary --show failures --format json)
if [ $(echo "$SUMMARY" | \
jq 'all(.[]; .[1].failed == 0 and .[1].errored == 0 and .[1].skipped == 0)') == false ]; then
echo "Implementations metadata file generated for json-schema.org is invalid under its JSON Schema"
exit 1
fi

- uses: actions/upload-artifact@v4
with:
name: implementations
path: implementations.json

- uses: actions/upload-artifact@v4
with:
name: api
path: api

site:
needs:
- regenerate-reports
Expand All @@ -114,12 +163,18 @@ jobs:
path: site/
merge-multiple: true

- name: Include Implementation Metadata
- name: Include Implementations metadata file for private API
uses: actions/download-artifact@v4
with:
name: implementations
path: site/

- name: Include api directory
uses: actions/download-artifact@v4
with:
name: api
path: site/api

- name: Generate Badges
run: bowtie badges

Expand Down
55 changes: 55 additions & 0 deletions bowtie/schemas/api/v1/json-schema-org/implementations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"title": "Implementations metadata file suitable for use by json-schema.org",
"description": "JSON file providing metadata about implementations of JSON Schema supported by Bowtie",

"$schema": "https://json-schema.org/draft/2020-12/schema",

"$id": "tag:bowtie.report,2024:api:v1:json-schema-org:implementations",

"type": "object",
"propertyNames": {
"description": "A URL where the implementation's source code is hosted",

"type": "string",
"format": "uri"
},
"additionalProperties": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands.",

"type": "array",
"items": { "type": "string", "format": "uri" }
},
"badges_urls": {
"type": "object",
"properties": {
"supported_versions": {
"type": "string",
"format": "uri"
},
"dialects_compliance": {
"type": "object",
"propertyNames": {
"readOnly": true,
"type": "string",
"pattern": "[a-z]+[a-z0-9-]*"
},
"additionalProperties": {
"type": "string",
"format": "uri"
}
}
},
"required": ["supported_versions", "dialects_compliance"],
"additionalProperties": false
}
},
"required": ["id", "dialects", "badges_urls"],
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"title": "Implementations metadata file suitable for use by json-schema.org",
"description": "JSON file providing metadata about implementations of JSON Schema supported by Bowtie",

"$schema": "https://json-schema.org/draft/2020-12/schema",

"$id": "tag:bowtie.report,2024:api:v1:json-schema-org:implementations",

"type": "object",
"propertyNames": {
"description": "A URL where the implementation's source code is hosted",

"type": "string",
"format": "uri"
},
"additionalProperties": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands.",

"type": "array",
"items": { "type": "string", "format": "uri" }
},
"badges_urls": {
"type": "object",
"properties": {
"supported_versions": {
"type": "string",
"format": "uri"
},
"dialects_compliance": {
"type": "object",
"propertyNames": {
"readOnly": true,
"type": "string",
"pattern": "[a-z]+[a-z0-9-]*"
},
"additionalProperties": {
"type": "string",
"format": "uri"
}
}
},
"required": ["supported_versions", "dialects_compliance"],
"additionalProperties": false
}
},
"required": ["id", "dialects", "badges_urls"],
"additionalProperties": false
}
}