Skip to content

Commit

Permalink
pes-events-schema: Fix the schema & add provided_data_streams
Browse files Browse the repository at this point in the history
The original schema has not reflected correctly the data format
of the pes-events.json file that has been used for a long time.
The schema is fixed now + some additional small changes have been
done to improve the readability.

Also added provided_data_streams that is now mandatory. This validates
correctly PES data introduced by following PR:
    oamg/leapp-repository#1092
  • Loading branch information
pirat89 committed Jun 19, 2023
1 parent af33438 commit b50a798
Showing 1 changed file with 144 additions and 105 deletions.
249 changes: 144 additions & 105 deletions pes-events-schema-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,147 @@
"$id": "https://raw.githubusercontent.com/oamg/schema-test/main/pes-events-schema-test.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Package Evolution Service - Events",
"type": "array",
"items": {
"type": "object",
"properties": {
"action": {
"type": "integer",
"description": "0 = Removal, 1 = Presence, 2 = Deprecation, 3 = Replacement, 4 = Split, 5 = Merge, 6 = Move, 7 = Rename"
},
"id": {
"type": "integer",
"description": "Unique ID of the event, used for debugging"
},
"release": {
"type": "object",
"required": [
"legal_notice",
"timestamp",
"packageinfo",
"provided_data_streams"
],
"properties": {
"legal_notice": {
"type": "string",
"title": "Just a legal notice...",
"examples": ["Copyright YYYY ...."]
},
"timestamp": {
"type": "string",
"title": "The datetime of the last data update.",
"description": "The expected format: YYYYMMDDhhmmZ (date -u \"+%Y%m%d%H%MZ\")",
"pattern": "^[0-9]{12}Z$",
"examples": [
"202107141655Z"
]
},
"provided_data_streams": {
"type": "array",
"title": "The list of data streams provided by this data file.",
"description": "Data streams is list of X.Y strings where X is mandatory is saying with what leapp-repository packages the data is compatible, Y is more informative for easier data identification..",
"examples": [
["1.0"],
["1.2", "2.0"]
],
"items": {
"type": "string",
"title": "Provided data stream",
"pattern": "^[1-9][0-9]*.[0-9]+$",
"examples": ["1.0", "1.1", "2.5", "10.100"]
}
},
"packageinfo": {
"type": "array",
"title": "List of PES events",
"items": {
"type": "object",
"description": "Release object describing when the event happened",
"title": "The PES event",
"required": [
"action",
"id",
"release",
"in_packageset",
"out_packageset",
"modulestream_maps",
"architectures"
],
"properties": {
"major_version": {
"action": {
"type": "integer",
"description": "Major version of the release"
},
"os_name": {
"type": "string",
"description": "Name of the operating system release"
"title": "Type (action) of the PES event representing what is happening with the package.",
"description": "0 = Removal, 1 = Presence, 2 = Deprecation, 3 = Replacement, 4 = Split, 5 = Merge, 6 = Move, 7 = Rename"
},
"minor_version": {
"id": {
"type": "integer",
"description": "Minor version of the release"
}
},
"required": [
"major_version",
"os_name",
"minor_version"
]
},
"in_packageset": {
"type": "object",
"description": "Describes one or more input packages, depending on the type of the event",
"properties": {
"package": {
"$ref": "#/$defs/package"
}
},
"required": [
"package"
]
},
"out_packageset": {
"anyOf": [{
"type": "object"
"description": "Unique ID of the event, used for debugging"
},
{
"type": "null"
}
],
"description": "Describes one or more output packages, depending on the type of the event",
"properties": {
"package": {
"$ref": "#/$defs/package"
}
},
"required": [
"package"
]
},
"modulestream_maps": {
"type": "array",
"description": "Describes the upgraded path of the specified modules",
"items": {
"type": "object",
"properties": {
"in_modulestream": {
"$ref": "#/$defs/modulestream"
"release": {
"type": "object",
"description": "Release object describing when the event happened",
"properties": {
"os_name": {
"type": "string",
"description": "Name of the operating system release",
"examples": ["RHEL", "Fedora", "Centos"]
},
"major_version": {
"type": "integer",
"description": "Major version of the release"
},
"minor_version": {
"type": "integer",
"description": "Minor version of the release"
}
},
"out_modulestream": {
"$ref": "#/$defs/modulestream"
"required": [
"os_name",
"major_version",
"minor_version"
]
},
"in_packageset": {
"type": "object",
"description": "Describes one or more input packages, depending on the type of the event",
"properties": {
"package": {
"$ref": "#/$defs/package"
}
},
"required": [
"package"
]
},
"out_packageset": {
"anyOf": [{
"type": "object"
},
{
"type": "null"
}
],
"description": "Describes one or more output packages, depending on the type of the event",
"properties": {
"package": {
"$ref": "#/$defs/package"
}
},
"required": [
"package"
]
},
"modulestream_maps": {
"type": "array",
"description": "Describes the upgraded path of the specified modules",
"items": {
"type": "object",
"properties": {
"in_modulestream": { "$ref": "#/$defs/modulestream" },
"out_modulestream": { "$ref": "#/$defs/modulestream" }
},
"required": [
"in_modulestream",
"out_modulestream"
]
}
},
"required": [
"in_modulestream",
"out_modulestream"
]
}
},
"architectures": {
"type": "array",
"description": "Describes all applicable architectures for the event",
"items": {
"type": "string"
"architectures": {
"type": "array",
"description": "Describes all applicable architectures for the event",
"items": {
"type": "string"
}
}
}
}
},
"required": [
"action",
"id",
"release",
"in_packageset",
"out_packageset",
"modulestream_maps",
"architectures"
]
}
},
"$defs": {
"modulestream": {
Expand All @@ -112,29 +152,33 @@
"null"
],
"properties": {
"name": {
"type": "string"
},
"stream": {
"type": "string"
}
"name": { "type": "string" },
"stream": { "type": "string" }
},
"required": [
"name",
"stream"
]
},
"package": {
"description": "List of packages belonging to a packageset",
"description": "List of binary packages belonging to a packageset",
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"repository",
"modulestreams"
],
"properties": {
"name": {
"type": "string"
"type": "string",
"title": "The name of the binary RPM."
},
"repository": {
"type": "string"
"type": "string",
"title": "The PES ID used in the PES database.",
"description": "The PES ID refers to a set of repositories which represent alternatives of one repository. E.g. BaseOS has a little different repository ID for every architecture, channel, ..."
},
"modulestreams": {
"type": "array",
Expand All @@ -143,12 +187,7 @@
"$ref": "#/$defs/modulestream"
}
}
},
"required": [
"name",
"repository",
"modulestreams"
]
}
}
}
}
Expand Down

0 comments on commit b50a798

Please sign in to comment.