Skip to content

Commit

Permalink
wip: build schema using NJsonSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Mar 31, 2024
1 parent b747115 commit 41a9920
Show file tree
Hide file tree
Showing 9 changed files with 626 additions and 41 deletions.
4 changes: 4 additions & 0 deletions source/Nuke.Build.Tests/Nuke.Build.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<ProjectReference Include="..\Nuke.Build\Nuke.Build.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NJsonSchema" Version="10.9.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Host": {
"type": "string",
"enum": [
"Rider",
"Terminal",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string"
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"$ref": "#/definitions/NukeBuild"
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"properties": {
"ComponentParam1": {
"BoolParam": {
"type": "boolean"
},
"ComplexParam": {
"type": "string"
},
"ComponentInheritedParam": {
"type": "string"
},
"Continue": {
Expand All @@ -31,15 +37,12 @@
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NullableBool": {
"NullableBoolParam": {
"type": "boolean"
},
"NullableInteger": {
"NullableIntegerParam": {
"type": "integer"
},
"Param": {
"type": "string"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
Expand Down Expand Up @@ -69,21 +72,26 @@
"items": {
"type": "string",
"enum": [
"Bar",
"Foo",
"Zoo"
"ExplicitTarget",
"ImplementedTarget",
"InheritedTarget",
"RegularTarget"
]
}
},
"StringParam": {
"type": "string"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Bar",
"Foo",
"Zoo"
"ExplicitTarget",
"ImplementedTarget",
"InheritedTarget",
"RegularTarget"
]
}
},
Expand Down Expand Up @@ -112,4 +120,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"BooleanParam": {
"type": "boolean"
},
"ComplexTypeArrayParam": {
"type": "array",
"items": {
"$ref": "#/definitions/ComplexType"
}
},
"ComplexTypeParam": {
"$ref": "#/definitions/ComplexType"
},
"ComponentInheritedParam": {
"type": "string"
},
"CustomEnumerationArrayParam": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Debug",
"Release"
]
}
},
"CustomEnumerationParam": {
"type": "string",
"enum": [
"Debug",
"Release"
]
},
"IntegerArrayParam": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
},
"NullableBooleanParam": {
"type": [
"boolean",
"null"
]
},
"RegularParam": {
"type": "string"
},
"SecretParam": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"StringArrayParam": {
"type": "array",
"items": {
"type": "string"
}
}
},
"definitions": {
"ComplexType": {
"type": "object",
"properties": {
"String": {
"type": [
"null",
"string"
]
},
"Number": {
"type": "integer",
"format": "int32"
},
"Paths": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"SubObject": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/ComplexSubType"
}
]
}
}
},
"ComplexSubType": {
"type": "object",
"properties": {
"Boolean": {
"type": [
"boolean",
"null"
]
}
}
},
"Host": {
"type": "string",
"enum": [
"Rider",
"Terminal",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string"
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"$ref": "#/definitions/NukeBuild"
}
Loading

0 comments on commit 41a9920

Please sign in to comment.