-
Notifications
You must be signed in to change notification settings - Fork 4
Implement github action to lint and validate JSON files #30
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8534e12
Implement github action to lint and validate JSON files
adam-gol 5dc0519
Don't lint the instance
adam-gol aee2331
Remove unnecessary "type" of "string" for enums that consist of solel…
adam-gol 3e0528c
Fixing invokation syntax
adam-gol 2480f46
Modified schema to describe an array of objects, not just a single ob…
adam-gol d8764ff
Update softbinding-algorithm-entry-schema.json
adam-gol 6dd8716
Update softbinding-algorithm-entry-schema.json
adam-gol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: JSON Schema Validation | ||
|
||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main, develop ] | ||
|
||
jobs: | ||
validate-json: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install sourcemeta json schema cli | ||
uses: sourcemeta/jsonschema@main | ||
|
||
- name: Lint JSON files | ||
run: | | ||
echo "Linting softbinding-algorithm-entry-schema.json..." | ||
set -e # Exit on any error | ||
jsonschema lint softbinding-algorithm-entry-schema.json | ||
echo "✓ softbinding-algorithm-entry-schema.json passed linting" | ||
|
||
- name: Validate against schema | ||
run: | | ||
echo "Validating softbinding-algorithm-list.json against schema..." | ||
set -e # Exit on any error | ||
jsonschema validate softbinding-algorithm-entry-schema.json softbinding-algorithm-list.json | ||
echo "✓ softbinding-algorithm-list.json is valid against the schema" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,114 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"type": "object", | ||
"properties": { | ||
"identifier": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 65535, | ||
"description": "This identifier will be assigned when the soft binding algorithm is added to the list." | ||
}, | ||
"deprecated": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Indicates whether this soft binding algorithm is deprecated. Deprecated algorithms shall not be used for creating soft bindings. Deprecated algorithms may be used for resolving soft bindings but this behaviour is discouraged." | ||
}, | ||
"alg": { | ||
"type": "string", | ||
"pattern": "(c2pa\\.|[A-Za-z0-9\\-\\.]+)", | ||
"description": "Entity-specific namespace as specified for C2PA Assertions labels that shall begin with the Internet domain name for the entity similar to how Java packages are defined (e.g., `com.example.algo1`, `net.example.algos.algo2`)" | ||
}, | ||
"type": { | ||
"type": "string", | ||
"enum": [ | ||
"watermark", | ||
"fingerprint" | ||
], | ||
"description": "Type of soft binding implemented by this algorithm." | ||
}, | ||
"decodedMediaTypes": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"$id": "https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"identifier": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 65535, | ||
"description": "This identifier will be assigned when the soft binding algorithm is added to the list." | ||
}, | ||
"deprecated": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Indicates whether this soft binding algorithm is deprecated. Deprecated algorithms shall not be used for creating soft bindings. Deprecated algorithms may be used for resolving soft bindings but this behaviour is discouraged." | ||
}, | ||
"alg": { | ||
"type": "string", | ||
"pattern": "(c2pa\\.|[A-Za-z0-9\\-\\.]+)", | ||
"description": "Entity-specific namespace as specified for C2PA Assertions labels that shall begin with the Internet domain name for the entity similar to how Java packages are defined (e.g., `com.example.algo1`, `net.example.algos.algo2`)" | ||
}, | ||
"type": { | ||
"enum": [ | ||
"application", | ||
"audio", | ||
"image", | ||
"model", | ||
"text", | ||
"video" | ||
"watermark", | ||
"fingerprint" | ||
], | ||
"description": "IANA top level media type (rendered) for which this soft binding algorithm applies." | ||
} | ||
}, | ||
"encodedMediaTypes": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"type": "string", | ||
"description": "IANA media type for which this soft binding algorithm applies, e.g., application/pdf", | ||
"pattern": "^([a-zA-Z0-9\\-]+\\/[a-zA-Z0-9\\-\\+]+(?:\\.[a-zA-Z0-9\\-\\+]+)*)$" | ||
} | ||
}, | ||
"entryMetadata": { | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"type": "string", | ||
"description": "Human readable description of the algorithm." | ||
}, | ||
"dateEntered": { | ||
"description": "Type of soft binding implemented by this algorithm." | ||
}, | ||
"decodedMediaTypes": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"enum": [ | ||
"application", | ||
"audio", | ||
"image", | ||
"model", | ||
"text", | ||
"video" | ||
], | ||
"description": "IANA top level media type (rendered) for which this soft binding algorithm applies." | ||
} | ||
}, | ||
"encodedMediaTypes": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "Date of entry for this algorithm." | ||
"description": "IANA media type for which this soft binding algorithm applies, e.g., application/pdf", | ||
"pattern": "^([a-zA-Z0-9\\-]+\\/[a-zA-Z0-9\\-\\+]+(?:\\.[a-zA-Z0-9\\-\\+]+)*)$" | ||
} | ||
}, | ||
"entryMetadata": { | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"type": "string", | ||
"description": "Human readable description of the algorithm." | ||
}, | ||
"dateEntered": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "Date of entry for this algorithm." | ||
}, | ||
"contact": { | ||
"type": "string", | ||
"format": "email" | ||
}, | ||
"informationalUrl": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "A web page containing more details about the algorithm." | ||
} | ||
}, | ||
"contact": { | ||
"required": [ | ||
"description", | ||
"dateEntered", | ||
"contact", | ||
"informationalUrl" | ||
] | ||
}, | ||
"softBindingResolutionApis": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"format": "email" | ||
"format": "uri" | ||
}, | ||
"informationalUrl": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "A web page containing more details about the algorithm." | ||
} | ||
}, | ||
"required": [ | ||
"description", | ||
"dateEntered", | ||
"contact", | ||
"informationalUrl" | ||
] | ||
"description": "A list of Soft Binding Resolution APIs supporting this algorithm." | ||
} | ||
}, | ||
"softBindingResolutionApis": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"format": "uri" | ||
"oneOf": [ | ||
{ | ||
"required": ["decodedMediaTypes"], | ||
"not": { | ||
"required": ["encodedMediaTypes"] | ||
} | ||
}, | ||
"description": "A list of Soft Binding Resolution APIs supporting this algorithm." | ||
} | ||
}, | ||
"required": [ | ||
"identifier", | ||
"alg", | ||
"type", | ||
"entryMetadata" | ||
], | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"decodedMediaTypes" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"encodedMediaTypes" | ||
] | ||
} | ||
] | ||
} | ||
{ | ||
"required": ["encodedMediaTypes"], | ||
"not": { | ||
"required": ["decodedMediaTypes"] | ||
} | ||
} | ||
], | ||
"required": [ | ||
"identifier", | ||
"alg", | ||
"type", | ||
"entryMetadata" | ||
] | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.