Skip to content

Commit

Permalink
[FEATURE] specVersion 2.1: Add support for "customConfiguration" (#308)
Browse files Browse the repository at this point in the history
Adds support for the "customConfiguration" configuration to provide
custom data. Must be handled by custom tools. Can be consumed when
using @ui5/project API.

Resolves: #304
  • Loading branch information
matz3 committed May 5, 2020
1 parent d5d98c4 commit 201aaab
Show file tree
Hide file tree
Showing 27 changed files with 2,363 additions and 3,091 deletions.
3 changes: 2 additions & 1 deletion lib/projectPreprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ class ProjectPreprocessor {
} else if (extension.specVersion !== "0.1" &&
extension.specVersion !== "1.0" &&
extension.specVersion !== "1.1" &&
extension.specVersion !== "2.0") {
extension.specVersion !== "2.0" &&
extension.specVersion !== "2.1") {
throw new Error(
`Unsupported specification version ${extension.specVersion} defined for extension ` +
`${extension.metadata.name}. Your UI5 CLI installation might be outdated. ` +
Expand Down
2 changes: 1 addition & 1 deletion lib/validation/schema/specVersion/2.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"specVersion": { "enum": ["2.1", "2.0"] },
"kind": {
"enum": ["project", "extension", null],
"$comment": "Using null to allow not defining 'kind' which defaults to project"
Expand Down
2 changes: 1 addition & 1 deletion lib/validation/schema/specVersion/2.0/kind/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion", "kind", "type", "metadata"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"specVersion": { "enum": ["2.1", "2.0"] },
"kind": {
"enum": ["extension"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,57 @@
"$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/project-shim.json",

"type": "object",
"additionalProperties": false,
"required": ["specVersion", "kind", "type", "metadata", "shims"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["project-shim"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"if": {
"properties": {
"specVersion": { "enum": ["2.1"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": {
"enum": ["2.1"]
},
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["project-shim"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"shims": {
"$ref": "#/definitions/shims"
},
"customConfiguration": {
"type": "object",
"additionalProperties": true
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": {
"enum": ["2.0"]
},
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["project-shim"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"shims": {
"$ref": "#/definitions/shims"
}
}
},
"definitions": {
"shims": {
"type": "object",
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,54 @@
"$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/server-middleware.json",

"type": "object",
"additionalProperties": false,

"required": ["specVersion", "kind", "type", "metadata", "middleware"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["server-middleware"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"if": {
"properties": {
"specVersion": { "enum": ["2.1"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["server-middleware"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"middleware": {
"$ref": "#/definitions/middleware"
},
"customConfiguration": {
"type": "object",
"additionalProperties": true
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["server-middleware"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"middleware": {
"$ref": "#/definitions/middleware"
}
}
},
"definitions": {
"middleware": {
"type": "object",
"additionalProperties": false,
Expand Down
58 changes: 46 additions & 12 deletions lib/validation/schema/specVersion/2.0/kind/extension/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,53 @@
"$id": "http://ui5.sap/schema/specVersion/2.0/kind/extension/task.json",

"type": "object",
"additionalProperties": false,
"required": ["specVersion", "kind", "type", "metadata", "task"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["task"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"if": {
"properties": {
"specVersion": { "enum": ["2.1"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["task"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"task": {
"$ref": "#/definitions/task"
},
"customConfiguration": {
"type": "object",
"additionalProperties": true
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["extension"]
},
"type": {
"enum": ["task"]
},
"metadata": {
"$ref": "../extension.json#/definitions/metadata"
},
"task": {
"$ref": "#/definitions/task"
}
}
},
"definitions": {
"task": {
"type": "object",
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion lib/validation/schema/specVersion/2.0/kind/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion", "type"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"specVersion": { "enum": ["2.1", "2.0"] },
"kind": {
"enum": ["project", null],
"$comment": "Using null to allow not defining 'kind' which defaults to project"
Expand Down
82 changes: 65 additions & 17 deletions lib/validation/schema/specVersion/2.0/kind/project/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,78 @@
"$id": "http://ui5.sap/schema/specVersion/2.0/kind/project/application.json",

"type": "object",
"additionalProperties": false,
"required": ["specVersion", "type", "metadata"],
"properties": {
"specVersion": { "enum": ["2.0"] },
"specVersion": { "enum": ["2.1", "2.0"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
}
},

"if": {
"properties": {
"specVersion": { "enum": ["2.1"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
},
"customConfiguration": {
"type": "object",
"additionalProperties": true
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
}
}
},

Expand Down
Loading

0 comments on commit 201aaab

Please sign in to comment.