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

Initial commit of schema definition for invalid updates. #1083

Closed
72 changes: 72 additions & 0 deletions docs/invalid_update.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://osv.dev/import_status.schema.json",
"type": "object",
"default": {},
"title": "OSV.dev import status",
"description": "A schema for describing an OSV.dev import failure of an OSV record.",
"required": [
"invalid_records"
],
"properties": {
"invalid_records": {
"type": "array",
"default": [],
"title": "The invalid_records Schema",
Copy link
Member

Choose a reason for hiding this comment

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

nit: most of these titles don't really seem useful, and I don't think they're a required field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've improved on them.

"items": {
"type": "object",
"title": "A Schema",
Copy link
Member

Choose a reason for hiding this comment

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

This title is particularly unhelpful :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, yes it is. Improved.

"required": [
"id",
"reason"
],
"properties": {
"id": {
"type": "string",
"title": "The id Schema",
"examples": [
"GSD-2021-1001229",
"GSD-2022-1003535"
]
},
"reason": {
"type": "string",
"title": "The reason Schema",
"examples": [
"INVALID_JSON",
"DELETED"
]
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this have an enum field for the valid reasons?

If so, we could probably remove the examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh good call, I didn't realise you could do that.

},
"examples": [{
"id": "GSD-2021-1001229",
"reason": "INVALID_JSON"
},
{
"id": "GSD-2022-1003535",
"reason": "DELETED"
}]
},
"examples": [
[{
"id": "GSD-2021-1001229",
"reason": "INVALID_JSON"
},
{
"id": "GSD-2022-1003535",
"reason": "DELETED"
}]
]
}
},
"examples": [{
"invalid_records": [{
"id": "GSD-2021-1001229",
"reason": "INVALID_JSON"
},
{
"id": "GSD-2022-1003535",
"reason": "DELETED"
}]
}]
andrewpollock marked this conversation as resolved.
Show resolved Hide resolved
}