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

Add logical-version field version to the manifest schema #281

Merged
merged 1 commit into from
Oct 15, 2024
Merged
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
16 changes: 16 additions & 0 deletions core/src/main/java/org/wildfly/channel/ChannelManifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public class ChannelManifest {
*/
private final String id;

/**
* Optional human-readable version of the manifest.
* Alphanumeric version of manifest. Note, this version does *not* need to align with the Maven coordinate version.
*/
private final String logicalVersion;

/**
* Optional description of the manifest. It can use multiple lines.
*/
Expand Down Expand Up @@ -86,6 +92,7 @@ public ChannelManifest(String name,
this(ChannelManifestMapper.CURRENT_SCHEMA_VERSION,
name,
id,
null,
description,
Collections.emptyList(),
streams);
Expand All @@ -98,12 +105,14 @@ public ChannelManifest(String name,
*/
public ChannelManifest(String name,
String id,
String logicalVersion,
String description,
Collection<ManifestRequirement> manifestRequirements,
Collection<Stream> streams) {
this(ChannelManifestMapper.CURRENT_SCHEMA_VERSION,
name,
id,
logicalVersion,
description,
manifestRequirements,
streams);
Expand All @@ -122,12 +131,14 @@ public ChannelManifest(String name,
public ChannelManifest(@JsonProperty(value = "schemaVersion", required = true) String schemaVersion,
@JsonProperty(value = "name") String name,
@JsonProperty(value = "id") String id,
@JsonProperty(value = "logical-version") String logicalVersion,
@JsonProperty(value = "description") String description,
@JsonProperty(value = "requires") Collection<ManifestRequirement> manifestRequirements,
@JsonProperty(value = "streams") Collection<Stream> streams) {
this.schemaVersion = schemaVersion;
this.name = name;
this.id = id;
this.logicalVersion = logicalVersion;
this.description = description;
this.manifestRequirements = new ArrayList<>();
if (manifestRequirements != null) {
Expand All @@ -154,6 +165,11 @@ public String getId() {
return id;
}

@JsonInclude(NON_NULL)
public String getLogicalVersion() {
return logicalVersion;
}

@JsonInclude(NON_NULL)
public String getDescription() {
return description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
public class ChannelManifestMapper {

public static final String SCHEMA_VERSION_1_0_0 = "1.0.0";
public static final String CURRENT_SCHEMA_VERSION = SCHEMA_VERSION_1_0_0;
public static final String SCHEMA_VERSION_1_1_0 = "1.1.0";
public static final String CURRENT_SCHEMA_VERSION = SCHEMA_VERSION_1_1_0;

private static final String SCHEMA_1_0_0_FILE = "org/wildfly/manifest/v1.0.0/schema.json";
private static final String SCHEMA_1_1_0_FILE = "org/wildfly/manifest/v1.1.0/schema.json";
private static final YAMLFactory YAML_FACTORY = new YAMLFactory()
.configure(YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR, true);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(YAML_FACTORY)
Expand All @@ -64,6 +66,7 @@ public class ChannelManifestMapper {

static {
SCHEMAS.put(SCHEMA_VERSION_1_0_0, SCHEMA_FACTORY.getSchema(ChannelManifestMapper.class.getClassLoader().getResourceAsStream(SCHEMA_1_0_0_FILE)));
SCHEMAS.put(SCHEMA_VERSION_1_1_0, SCHEMA_FACTORY.getSchema(ChannelManifestMapper.class.getClassLoader().getResourceAsStream(SCHEMA_1_1_0_FILE)));
}

private static JsonSchema getSchema(JsonNode node) {
Expand Down
96 changes: 96 additions & 0 deletions core/src/main/resources/org/wildfly/manifest/v1.1.0/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$id": "https://wildfly.org/manifests/v1.0.0/schema.json",
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"type": "object",
"required": ["schemaVersion"],
"properties": {
"schemaVersion": {
"description": "The version of the schema defining a manifest resource.",
"type": "string",
"pattern": "^[0-9]+.[0-9]+.[0-9]+$"
},
"id": {
"description": "ID of the manifest. Used to resolved inter-channel requirements."
},
"name": {
"description": "Name of the manifest. This is a one-line human-readable description of the manifest",
"type": "string"
},
"description": {
"description": "Description of the manifest. This is a multi-lines human-readable description of the manifest",
"type": "string"
},
"logical-version": {
"description": "Version of the manifest. This is a short, one-line, human-readable version of the manifest. Note it is not necessary the same as manifest's Maven version.",
"type": "string"
},
"requires": {
"description": "Manifests that are required by this manifest.",
"type": "array",
"items": {
"type": "object",
"minItems": 1,
"properties": {
"id": {
"description": "ID of the required manifest.",
"type": "string"
},
"maven": {
"type": "object",
"properties": {
"groupId": {
"description": "GroupID Maven coordinate of the required manifest",
"type": "string"
},
"artifactId": {
"description": "ArtifactID Maven coordinate of the required manifest",
"type": "string"
},
"version": {
"description": "Version Maven coordinate of the required manifest",
"type": "string"
}
},
"required": ["groupId", "artifactId"]
}
},
"required": ["id"]
}
},
"streams":{
"description": "Streams of components that are provided by this channel",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"groupId": {
"description": "GroupId of the stream. It must be a valid groupId (corresponding to a G of a Maven GAV)",
"type": "string"
},
"artifactId": {
"description": "ArtifactId of the stream. It must be either a valid artifactId (corresponding to a A of a Maven GAV) or the * character to represent any artifactId",
"type": "string"
},
"version" : {
"description": "Version of the stream. This must be a single version. Only one of version, versionPattern must be set.",
"type": "string"
},
"versionPattern" : {
"description": "VersionPattern of the stream. This is a regular expression that matches any version from this stream. Only one of version, versionPattern must be set.",
"type": "string"
}
},
"required": ["groupId", "artifactId"],
"oneOf": [
{
"required": ["version"]
},
{
"required": ["versionPattern"]
}
]
}
}
}
}
8 changes: 7 additions & 1 deletion core/src/test/java/org/wildfly/channel/ManifestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,24 @@
class ManifestBuilder {

private String id;
private String logicalVersion;
private List<ManifestRequirement> requirements = new ArrayList<>();
private List<Stream> streams = new ArrayList<>();

ChannelManifest build() {
return new ChannelManifest(null, id, null, requirements, streams);
return new ChannelManifest(null, id, logicalVersion, null, requirements, streams);
}

ManifestBuilder setId(String id) {
this.id = id;
return this;
}

public ManifestBuilder setLogicalVersion(String logicalVersion) {
this.logicalVersion = logicalVersion;
return this;
}

ManifestBuilder addRequires(String requiredId) {
requirements.add(new ManifestRequirement(requiredId, null));
return this;
Expand Down
6 changes: 3 additions & 3 deletions doc/spec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[cols="1,1"]
|===
| Channel schema Version | 2.0.0
| Manifest schema Version | 1.0.0
| Manifest schema Version | 1.1.0
| Blocklist schema Version | 1.0.0
|===

Expand Down Expand Up @@ -83,6 +83,7 @@ A Channel Manifest is composed of following fields:
* An optional `name` that is a human-readable one-line description of the channel (`manifest for WildFly 27`)
* An optional `id` element that is used to identify channel.
* An optional `description` that provides human-readable description of the channel
* An optional `logical-version` that provides a human-readable short description of the version of the manifest. Note this may, but doesn't need to correspond to the Maven version of the artifact (from Manifest schema 1.1.0).
* A collection of `requires`. Each element of that list corresponds to another channel that is required to provision components from this channel.
This field can be used for layered products to enforce their dependencies so that the installation only need to update the top level channel to get updates from all required channels.
Each element is composed of:
Expand Down Expand Up @@ -241,5 +242,4 @@ During artifact version resolution, a stream matching artifact GA is located in

### Version 1.0.0

* Initial release of the Channel specification

* Initial release of the Channel specification
Loading