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

Move schema.json from validation to docs #232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
313 changes: 313 additions & 0 deletions docs/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would validation/schema.json being a symlink break existing users depending on the https://raw.githubusercontent.com/ossf/osv-schema/main/validation/schema.json link ?

What if we made the docs/schema.json a symlink instead to this instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked and it doesn't work 😢 https://raw.githubusercontent.com/JamieMagee/osv-schema/github-pages-schema/validation/schema.json

Unfortunately doing it the other way round doesn't work either. What do you think about duplicating the file? Or just having it in docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

darn :/

Re "other way around doesn't work": do you mean having validation/schema.json be the source of truth, and having docs/schema.json as a symlink doesn't work either when it comes to the GitHub site generation?

Interestingly, it seems to work here: https://github.com/s4y/gh-pages-symlink-test

"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/ossf/osv-schema/main/validation/schema.json",
"title": "Open Source Vulnerability",
"description": "A schema for describing a vulnerability in an open source package.",
"type": "object",
"properties": {
"schema_version": {
"type": "string"
},
"id": {
"type": "string"
},
"modified": {
"$ref": "#/$defs/timestamp"
},
"published": {
"$ref": "#/$defs/timestamp"
},
"withdrawn": {
"$ref": "#/$defs/timestamp"
},
"aliases": {
"type": ["array", "null"],
"items": {
"type": "string"
}
},
"related": {
"type": "array",
"items": {
"type": "string"
}
},
"summary": {
"type": "string"
},
"details": {
"type": "string"
},
"severity": {
"$ref": "#/$defs/severity"
},
"affected": {
"type": ["array", "null"],
"items": {
"type": "object",
"properties": {
"package": {
"type": "object",
"properties": {
"ecosystem": {
"type": "string"
},
"name": {
"type": "string"
},
"purl": {
"type": "string"
}
},
"required": [
"ecosystem",
"name"
]
},
"severity": {
"$ref": "#/$defs/severity"
},
"ranges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"GIT",
"SEMVER",
"ECOSYSTEM"
]
},
"repo": {
"type": "string"
},
"events": {
"type": "array",
"contains": {
"required": [
"introduced"
]
},
"items": {
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"introduced": {
"type": "string"
}
},
"required": [
"introduced"
]
},
{
"type": "object",
"properties": {
"fixed": {
"type": "string"
}
},
"required": [
"fixed"
]
},
{
"type": "object",
"properties": {
"last_affected": {
"type": "string"
}
},
"required": [
"last_affected"
]
},
{
"type": "object",
"properties": {
"limit": {
"type": "string"
}
},
"required": [
"limit"
]
}
]
},
"minItems": 1
},
"database_specific": {
"type": "object"
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "GIT"
}
}
},
"then": {
"required": [
"repo"
]
}
},
{
"if": {
"properties": {
"events": {
"contains": {
"required": ["last_affected"]
}
}
}
},
"then": {
"not": {
"properties": {
"events": {
"contains": {
"required": ["fixed"]
}
}
}
}
}
}
],
"required": [
"type",
"events"
]
}
},
"versions": {
"type": "array",
"items": {
"type": "string"
}
},
"ecosystem_specific": {
"type": "object"
},
"database_specific": {
"type": "object"
}
}
}
},
"references": {
"type": ["array", "null"],
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"ADVISORY",
"ARTICLE",
"DETECTION",
"DISCUSSION",
"REPORT",
"FIX",
"INTRODUCED",
"GIT",
"PACKAGE",
"EVIDENCE",
"WEB"
]
},
"url": {
"type": "string",
"format": "uri"
}
},
"required": [
"type",
"url"
]
}
},
"credits": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"contact": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"FINDER",
"REPORTER",
"ANALYST",
"COORDINATOR",
"REMEDIATION_DEVELOPER",
"REMEDIATION_REVIEWER",
"REMEDIATION_VERIFIER",
"TOOL",
"SPONSOR",
"OTHER"
]
}
},
"required": [
"name"
]
}
},
"database_specific": {
"type": "object"
}
},
"required": [
"id",
"modified"
],
"$defs": {
"severity": {
"type": ["array", "null"],
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"CVSS_V2",
"CVSS_V3",
"CVSS_V4"
]
},
"score": {
"type": "string"
}
},
"required": [
"type",
"score"
]
}
},
"timestamp": {
"type": "string",
"format": "date-time",
"pattern": "[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z"
}
},
"additionalProperties": false
}
Loading