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

A public directory structure for serving implementations.json to json-schema-org #1331

Closed
wants to merge 4 commits into from
Closed
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
49 changes: 47 additions & 2 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,48 @@ 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 public-implementations (Public API) file
run: |
bowtie filter-implementations | \
while read -r impl; do
bowtie info -i $impl --format json | \
jq --arg impl "$impl" '
{(.source): (
. + {name: $impl}
| del(
.os,
.os_version,
.source
)
)}
'
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/public-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 +147,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
77 changes: 77 additions & 0 deletions bowtie/schemas/public-implementations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"title": "Public Implementations",
"description": "A Public 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:models:public-implementations",

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

"type": "string",
"format": "uri"
},
"additionalProperties": {
"type": "object",
"required": ["name", "language", "dialects", "homepage", "issues"],
"properties": {
"name": { "type": "string" },
"language": {
"description": "The implementation language (e.g. C++, Python, etc.)",

"type": "string",
"pattern": "^[a-z][a-z0-9-+_]*$"
},
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands. When running test cases, this list will be consulted before sending them to the implementation (and any unsupported dialects will be skipped).",

"type": "array",
"items": { "type": "string", "format": "uri" }
},
"homepage": {
"description": "A URL for the implementation's homepage",

"type": "string",
"format": "uri"
},
"issues": {
"description": "A URL for the implementation's bug tracker",

"type": "string",
"format": "uri"
},
"version": {
"description": "The implementation version",

"type": "string"
},
"language_version": {
"description": "Version of language used to run the implementation",
"type": "string"
},
"documentation": {
"description": "A URL for the implementation's documentation",

"type": "string",
"format": "uri"
},
"links": {
"description": "Additional web page links relevant to the implementation",

"type": "array",
"items": {
"type": "object",
"required": ["description", "url"],
"properties": {
"description": { "type": "string" },
"url": { "type": "string", "format": "uri" }
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"title": "Public Implementations",
"description": "A Public 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:models:public-implementations",

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

"type": "string",
"format": "uri"
},
"additionalProperties": {
"type": "object",
"required": ["name", "language", "dialects", "homepage", "issues"],
"properties": {
"name": { "type": "string" },
"language": {
"description": "The implementation language (e.g. C++, Python, etc.)",

"type": "string",
"pattern": "^[a-z][a-z0-9-+_]*$"
},
"dialects": {
"description": "A list of JSON Schema dialects (URIs) which the implementation understands. When running test cases, this list will be consulted before sending them to the implementation (and any unsupported dialects will be skipped).",

"type": "array",
"items": { "type": "string", "format": "uri" }
},
"homepage": {
"description": "A URL for the implementation's homepage",

"type": "string",
"format": "uri"
},
"issues": {
"description": "A URL for the implementation's bug tracker",

"type": "string",
"format": "uri"
},
"version": {
"description": "The implementation version",

"type": "string"
},
"language_version": {
"description": "Version of language used to run the implementation",
"type": "string"
},
"documentation": {
"description": "A URL for the implementation's documentation",

"type": "string",
"format": "uri"
},
"links": {
"description": "Additional web page links relevant to the implementation",

"type": "array",
"items": {
"type": "object",
"required": ["description", "url"],
"properties": {
"description": { "type": "string" },
"url": { "type": "string", "format": "uri" }
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
Loading