-
Notifications
You must be signed in to change notification settings - Fork 40
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
ROLIE feed schema #481
Draft
tschmidtb51
wants to merge
6
commits into
oasis-tcs:master
Choose a base branch
from
tschmidtb51:ROLIE-schema
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
ROLIE feed schema #481
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2bfb831
JSON schema for ROLIE feed
tschmidtb51 33d612e
JSON schema for ROLIE feed
tschmidtb51 2df1632
JSON schema for ROLIE feed
tschmidtb51 91a20ab
JSON schema for ROLIE feed
tschmidtb51 09964cc
JSON schema for ROLIE feed
tschmidtb51 81b2663
Merge branch 'master' into ROLIE-schema
tschmidtb51 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 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
This file contains 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
This file contains 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,292 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://raw.githubusercontent.com/oasis-tcs/csaf/master/csaf_2.0/json_schema/ROLIE_feed_json_schema.json", | ||
"title": "ROLIE Feed auxiliary Schema", | ||
"description": "Representation of CSAF ROLIE feed as a JSON document.", | ||
"$defs": { | ||
"json_link_t": { | ||
"title": "JSON Link", | ||
"description": "Contains the URL of the JSON file.", | ||
"type": "string", | ||
"format": "uri", | ||
"pattern": "^https://.+\\.json$" | ||
}, | ||
"link_t": { | ||
"title": "List of Links", | ||
"description": "Contains a list of links related to the current context.", | ||
"type": "array", | ||
"prefixItems": [ | ||
{ | ||
"title": "Link", | ||
"description": "Specifies the JSON link.", | ||
"type": "object", | ||
"required": [ | ||
"rel", | ||
"href" | ||
], | ||
"properties": { | ||
"href": { | ||
"title": "Hyper reference", | ||
"description": "Contains the URL of the JSON file.", | ||
"$ref": "#/$defs/json_link_t" | ||
}, | ||
"rel": { | ||
"title": "Relationship", | ||
"description": "Contains the relationship value of the link.", | ||
"type": "string", | ||
"enum": [ | ||
"self" | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "Link", | ||
"description": "Specifies a single link.", | ||
"type": "object", | ||
"required": [ | ||
"rel", | ||
"href" | ||
], | ||
"properties": { | ||
"href": { | ||
"title": "Hyper reference", | ||
"description": "Contains the URL of the link.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"rel": { | ||
"title": "Relationship", | ||
"description": "Contains the relationship value of the link.", | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"type": "object", | ||
"required": [ | ||
"feed" | ||
], | ||
"properties": { | ||
"feed": { | ||
"title": "CSAF ROLIE feed", | ||
"description": "Contains all information of the feed.", | ||
"type": "object", | ||
"required": [ | ||
"id", | ||
"title", | ||
"link", | ||
"category", | ||
"updated", | ||
"entry" | ||
], | ||
"properties": { | ||
"id": { | ||
"title": "ID", | ||
"description": "Contains a unique identifier for this ROLIE feed.", | ||
"type": "string", | ||
"pattern": "^[a-zA-Z0-9+\\-_\\.]+$", | ||
"minLength": 1 | ||
}, | ||
"title": { | ||
"title": "Feed title", | ||
"description": "Contains the title for this ROLIE feed.", | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"link": { | ||
"title": "List of Links", | ||
"description": "Contains a list of links related to this feed.", | ||
"$ref": "#/$defs/link_t" | ||
}, | ||
"category": { | ||
"title": "List of Categories", | ||
"description": "Contains a list of categories related to this feed.", | ||
"type": "array", | ||
"prefixItems": [ | ||
{ | ||
"title": "CSAF ROLIE category", | ||
"description": "Contains the required ROLIE category value.", | ||
"type": "object", | ||
"required": [ | ||
"scheme", | ||
"term" | ||
], | ||
"properties": { | ||
"scheme": { | ||
"title": "Scheme", | ||
"description": "Contains the URI of the scheme to use.", | ||
"type": "string", | ||
"enum": [ | ||
"urn:ietf:params:rolie:category:information-type" | ||
] | ||
}, | ||
"term": { | ||
"title": "Term", | ||
"description": "Contains the term that is valid in the context of the scheme.", | ||
"type": "string", | ||
"enum": [ | ||
"csaf" | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "Category", | ||
"description": "Specifies a single category.", | ||
"type": "object", | ||
"required": [ | ||
"scheme", | ||
"term" | ||
], | ||
"properties": { | ||
"scheme": { | ||
"title": "Scheme", | ||
"description": "Contains the URI of the scheme to use.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"term": { | ||
"title": "Term", | ||
"description": "Contains the term that is valid in the context of the scheme.", | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
} | ||
}, | ||
"updated": { | ||
"title": "Updated", | ||
"description": "Contains the date and time this feed was updated the last time.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"entry": { | ||
"title": "List of Entries", | ||
"description": "Contains a list of feed entries.", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "Entry", | ||
"description": "Contains all information for a single feed entry.", | ||
"type": "object", | ||
"required": [ | ||
"id", | ||
"title", | ||
"link", | ||
"published", | ||
"updated", | ||
"content", | ||
"format" | ||
], | ||
"properties": { | ||
"id": { | ||
"title": "ID", | ||
"description": "Contains the document tracking ID of the CSAF document.", | ||
"type": "string", | ||
"pattern": "^[\\S](.*[\\S])?$", | ||
"minLength": 1 | ||
}, | ||
"title": { | ||
"title": "Title", | ||
"description": "Contains the document title of the CSAF document.", | ||
"type": "string", | ||
"minLength": 1 | ||
}, | ||
"link": { | ||
"title": "List of Links", | ||
"description": "Contains a list of links related to this entry.", | ||
"$ref": "#/$defs/link_t" | ||
}, | ||
"published": { | ||
"title": "Published", | ||
"description": "Contains the date and time this entry was initially added to the feed.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"updated": { | ||
"title": "Updated", | ||
"description": "Contains the date and time this entry was the last time updated in the feed.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"summary": { | ||
"title": "", | ||
"description": "", | ||
"type": "object", | ||
"properties": { | ||
"content": { | ||
"title": "", | ||
"description": "", | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
}, | ||
"content": { | ||
"title": "Content of the entry", | ||
"description": "Contains information about the content.", | ||
"type": "object", | ||
"required": [ | ||
"type", | ||
"src" | ||
], | ||
"properties": { | ||
"src": { | ||
"title": "Source Code", | ||
"description": "Contains a link to the source code of the file", | ||
"$ref": "#/$defs/json_link_t" | ||
}, | ||
"type": { | ||
"title": "MIME type", | ||
"description": "Contains the MIME type of the content.", | ||
"type": "string", | ||
"enum": [ | ||
"application/json" | ||
] | ||
} | ||
} | ||
}, | ||
"format": { | ||
"title": "", | ||
"description": "", | ||
"type": "object", | ||
"required": [ | ||
"schema", | ||
"version" | ||
], | ||
"properties": { | ||
"schema": { | ||
"title": "Schema of the entry", | ||
"description": "Contains the schema the CSAF document is valid against.", | ||
"type": "string", | ||
"enum": [ | ||
"https://docs.oasis-open.org/csaf/csaf/v2.0/csaf_json_schema.json" | ||
] | ||
}, | ||
"version": { | ||
"title": "CSAF Version", | ||
"description": "Contains the CSAF version the document was written in.", | ||
"type": "string", | ||
"enum": [ | ||
"2.0" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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,43 @@ | ||
#!/bin/bash | ||
|
||
ORIG_SCHEMA=csaf_2.0/json_schema/ROLIE_feed_json_schema.json | ||
STRICT_SCHEMA=ROLIE_feed_strict_schema.json | ||
VALIDATOR=csaf_2.0/test/validator.py | ||
STRICT_GENERATOR=csaf_2.0/test/generate_strict_schema.py | ||
TESTPATH=csaf_2.0/examples/ROLIE/*feed*.json | ||
|
||
FAIL=0 | ||
|
||
# go to root of git repository | ||
cd `dirname $0`/../../../.. | ||
|
||
validate() { | ||
printf "%s" "Testing file $1 against schema ${SCHEMA} ... " | ||
if python3 ${VALIDATOR} ${SCHEMA} $1; then | ||
printf "%s\n" SUCCESS | ||
else | ||
printf "%s\n" FAILED | ||
FAIL=1 | ||
fi | ||
|
||
} | ||
|
||
test_all() { | ||
for i in ${TESTPATH} | ||
do | ||
validate $i | ||
done | ||
} | ||
|
||
SCHEMA=${ORIG_SCHEMA} | ||
test_all | ||
|
||
|
||
printf "%s" "Generating strict schema ... " | ||
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${STRICT_SCHEMA}" | ||
printf "%s\n" "done" | ||
|
||
SCHEMA=${STRICT_SCHEMA} | ||
test_all | ||
|
||
exit ${FAIL} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest we maintain lowercase file names and identities.
Maybe we should discuss the folder location also, as schema validation often is tried with identifying an identifier with a URL and maybe OASIS TC admins can help us with the folder location of schemas added "after the fact" of standardization - in the related issue I suggest using a sibling folder to
json_schema
with anoptional_
prefix. @chet-ensign @OASIS-OP-Admin can maybe guide us here?