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 2 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,58 @@ jobs:
with:
version: ${{ inputs.bowtie-version }}

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

- name: Generate implementations API file for JSON Schema Org
run: |
bowtie filter-implementations | \
while read -r impl; do
COMPLIANCE_URLS=( \
bowtie filter-dialects -i $impl | \
jq -R -s 'split("\n")[:-1] | map(. as $uri | input | fromjson | .[] | select(.uri == $uri) | \
"https://bowtie.report/badges/\($impl)/compliance/" + .shortName)' data/dialects.json
)

bowtie info -i $impl --format json | \
jq --arg impl "$impl" --argjson compliance "$COMPLIANCE_URLS" '
{(.source): (
{
id: $impl,
dialects: .dialects,
badges_urls: (
{
supported_versions: "https://bowtie.report/badges/\($impl)/supported_versions.json",
compliance: $compliance
}
)
}
)}
'
done | \
jq -s 'add' > public-implementations

- name: Validate public-implementations against its corresponding JSON Schema
run: |
VALIDATION=$(bowtie validate --expect valid -i python-jsonschema bowtie/schemas/api/v1/json-schema-org/implementations.json public-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 "public-implementations file 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: public-implementations
path: public-implementations

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

- name: Include Implementation Metadata
- name: Include Implementations Metadata (Private API)
uses: actions/download-artifact@v4
with:
name: implementations
path: site/

- name: Create a Public Directory Structure for JSON Schema Org
run: mkdir -p site/v1/json-schema-org

- name: Include Public Implementations Metadata (Public API)
uses: actions/download-artifact@v4
with:
name: public-implementations
path: site/v1/json-schema-org/

- name: Rename "public-implementations" file to just "implementations"
run: mv site/v1/json-schema-org/public-implementations site/v1/json-schema-org/implementations

- name: Generate Badges
run: bowtie badges

Expand Down
29 changes: 29 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,29 @@
{
"title": "Implementations API for JSON Schema Org",
"description": "API 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",
"required": ["dialects"],
"properties": {
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands.",

"type": "array",
"items": { "type": "string", "format": "uri" }
}
},
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title": "Implementations API for JSON Schema Org",
"description": "API 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",
"required": ["dialects"],
"properties": {
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands.",

"type": "array",
"items": { "type": "string", "format": "uri" }
}
},
"additionalProperties": false
}
}
Loading