diff --git a/Cargo.lock b/Cargo.lock index e514175..4491441 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3158,11 +3158,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.21" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" dependencies = [ "dyn-clone", + "ref-cast", "schemars_derive", "serde", "serde_json", @@ -3170,9 +3171,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.21" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +checksum = "4908ad288c5035a8eb12cfdf0d49270def0a268ee162b75eeee0f85d155a7c45" dependencies = [ "proc-macro2", "quote", @@ -3302,9 +3303,9 @@ dependencies = [ [[package]] name = "serde_derive_internals" -version = "0.29.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index e56d455..f6fdeb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ pathdiff = "0.2.2" petgraph = "0.6.5" regex = "1.11.0" reqwest = { version = "0.12", features = ["multipart", "rustls-tls", "native-tls-vendored" ] } -schemars = "0.8" +schemars = "*" secrecy = "0.8.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/schema/merged.json b/schema/merged.json index e462a65..c320a59 100644 --- a/schema/merged.json +++ b/schema/merged.json @@ -3,43 +3,41 @@ "title": "ScopeTypes", "anyOf": [ { - "$ref": "#/definitions/V1AlphaReportLocation" + "$ref": "#/$defs/V1AlphaReportLocation" }, { - "$ref": "#/definitions/V1AlphaKnownError" + "$ref": "#/$defs/V1AlphaKnownError" }, { - "$ref": "#/definitions/V1AlphaDoctorGroup" + "$ref": "#/$defs/V1AlphaDoctorGroup" } ], - "definitions": { + "$defs": { "DoctorCheckSpec": { - "description": "What needs to be checked before the action will run. `paths` will be checked first, then `commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", + "description": "What needs to be checked before the action will run. `paths` will be checked first, then\n`commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", "type": "object", "properties": { "commands": { "description": "A list of commands to execute to check the environment.", - "default": null, "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } }, "paths": { - "description": "A list of globs to check for changes. When the glob matches a new file, or the contents of the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working directory.", - "default": null, + "description": "A list of globs to check for changes. When the glob matches a new file, or the contents\nof the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working\ndirectory.", "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } } }, "additionalProperties": false @@ -49,17 +47,16 @@ "properties": { "extraContext": { "description": "Additional context for why they're being prompted for approval", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "text": { "description": "Yes/No question presented to the user", - "default": "", - "type": "string" + "type": "string", + "default": "" } }, "additionalProperties": false @@ -70,89 +67,84 @@ "properties": { "commands": { "description": "List of commands to run to fix the env.", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } }, "helpText": { "description": "Text to display when no command is provided / fails to fix the env.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "helpUrl": { "description": "Link to documentation to fix the issue.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "prompt": { "description": "When present, user will be prompted for approval before running the fix", - "default": null, "anyOf": [ { - "$ref": "#/definitions/DoctorFixPromptSpec" + "$ref": "#/$defs/DoctorFixPromptSpec" }, { "type": "null" } ], - "nullable": true + "default": null } }, "additionalProperties": false }, "DoctorGroupActionSpec": { - "description": "An action is a single step used to check in a group. This is most commonly used to build a series of tasks for a system, like `ruby`, `python`, and databases.", + "description": "An action is a single step used to check in a group. This is most commonly used to build a\nseries of tasks for a system, like `ruby`, `python`, and databases.", "type": "object", - "required": [ - "check", - "name" - ], "properties": { "check": { - "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs to be executed, or fail the action if no fix is provided. If a fix is specified, the check will re-execute to ensure that the fix applied correctly.", - "$ref": "#/definitions/DoctorCheckSpec" + "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs\nto be executed, or fail the action if no fix is provided. If a fix is specified, the check\nwill re-execute to ensure that the fix applied correctly.", + "$ref": "#/$defs/DoctorCheckSpec" }, "description": { "description": "A description of this specific action, used for information to the users.", "type": [ "string", "null" - ], - "nullable": true + ] }, "fix": { - "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only run when the `check` \"fails\".", + "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only\nrun when the `check` \"fails\".", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "name": { "description": "Name of the \"action\" used when reporting status to the users.", "type": "string" }, "required": { - "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults to `true`.", - "default": true, - "type": "boolean" + "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults\nto `true`.", + "type": "boolean", + "default": true } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "name", + "check" + ] }, "DoctorGroupKind": { "type": "string", @@ -161,64 +153,60 @@ ] }, "DoctorGroupSpec": { - "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to depend on other \"system\".", + "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to\ndepend on other \"system\".", "type": "object", - "required": [ - "actions" - ], "properties": { "actions": { "description": "A series of steps to check and fix for the group.", "type": "array", "items": { - "$ref": "#/definitions/DoctorGroupActionSpec" + "$ref": "#/$defs/DoctorGroupActionSpec" } }, "include": { - "description": "Change how a group is handled when building the dependency task graph. When set to `when-required`, the group will be ignored unless it's required by another dependency.", - "default": "by-default", - "$ref": "#/definitions/DoctorInclude" + "description": "Change how a group is handled when building the dependency task graph.\nWhen set to `when-required`, the group will be ignored unless it's required by another\ndependency.", + "$ref": "#/$defs/DoctorInclude", + "default": "by-default" }, "needs": { - "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish successfully, this group will not execute.", - "default": [], + "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish\nsuccessfully, this group will not execute.", "type": "array", + "default": [], "items": { "type": "string" } }, "reportExtraDetails": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `reportExtraDetails` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`reportExtraDetails` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "skip": { - "description": "Defines conditions under which the group should be skipped. `skip` can be a boolean, in which case the group will be skipped if `true`. Alternatively, it can be a command that will be run to determine if the group should be skipped. If the command returns a zero exit code, the group will be skipped. If the command returns a non-zero exit code, the group will not be skipped.", - "default": false, - "$ref": "#/definitions/SkipSpec" + "description": "Defines conditions under which the group should be skipped.\n`skip` can be a boolean, in which case the group will be skipped if `true`.\nAlternatively, it can be a command that will be run to determine if the group should\nbe skipped. If the command returns a zero exit code, the group will be skipped.\nIf the command returns a non-zero exit code, the group will not be skipped.", + "$ref": "#/$defs/SkipSpec", + "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "actions" + ] }, "DoctorInclude": { "description": "Configure how a groups will be used when determining the task graph.", "oneOf": [ { - "description": "Default option, the group will be included by default when determining which groups should run.", + "description": "Default option, the group will be included by default when determining which groups should\nrun.", "type": "string", - "enum": [ - "by-default" - ] + "const": "by-default" }, { "description": "Useful for shared configuration. The group will not run unless another group depends on it.", "type": "string", - "enum": [ - "when-required" - ] + "const": "when-required" } ] }, @@ -231,22 +219,17 @@ "KnownErrorSpec": { "description": "Definition of the known error", "type": "object", - "required": [ - "help", - "pattern" - ], "properties": { "fix": { "description": "An optional fix the user will be prompted to run.", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "help": { "description": "Text that the user can use to fix the issue", @@ -257,42 +240,44 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "help", + "pattern" + ] }, "ModelMetadata": { "type": "object", - "required": [ - "name" - ], "properties": { "annotations": { "description": "Annotations attach arbitrary non-identifying metadata to objects.", + "$ref": "#/$defs/ModelMetadataAnnotations", "default": { "scope.github.com/bin-path": null, - "scope.github.com/file-dir": null, - "scope.github.com/file-path": null, "working_dir": null - }, - "$ref": "#/definitions/ModelMetadataAnnotations" + } }, "description": { - "description": "Description of this resource, used when listing resources and helpful to inform users why the resource exists.", - "default": "Description not provided", - "type": "string" + "description": "Description of this resource, used when listing resources and helpful to inform users why\nthe resource exists.", + "type": "string", + "default": "Description not provided" }, "labels": { "description": "Key/value pairs, allows resources to be easily filtered from the CLI.", - "default": {}, "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "name": { - "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name, the one \"closest\" to the current working directory will take precedence.", + "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name,\nthe one \"closest\" to the current working directory will take precedence.", "type": "string" } - } + }, + "required": [ + "name" + ] }, "ModelMetadataAnnotations": { "type": "object", @@ -302,26 +287,23 @@ "type": [ "string", "null" - ], - "nullable": true + ] }, "working_dir": { "description": "The current working directory of the scope command, generated automatically.", "type": [ "string", "null" - ], - "nullable": true + ] } + }, + "additionalProperties": { + "type": "string" } }, "ReportDestinationGithubIssueSpec": { "description": "How to load the report to GitHub Issue", "type": "object", - "required": [ - "owner", - "repo" - ], "properties": { "owner": { "description": "`owner` of the repository for the issue", @@ -333,80 +315,84 @@ }, "tags": { "description": "A list of tags to be added to the issue", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "owner", + "repo" + ] }, "ReportDestinationLocalSpec": { "description": "Create a report that is only local", "type": "object", - "required": [ - "directory" - ], "properties": { "directory": { "description": "Directory to put the report into", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "directory" + ] }, "ReportDestinationRustyPasteSpec": { "description": "How to upload a report to RustyPaste", "type": "object", - "required": [ - "url" - ], "properties": { "url": { "description": "URL of RustyPaste", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "url" + ] }, "ReportDestinationSpec": { "oneOf": [ { "type": "object", - "required": [ - "rustyPaste" - ], "properties": { "rustyPaste": { - "$ref": "#/definitions/ReportDestinationRustyPasteSpec" + "$ref": "#/$defs/ReportDestinationRustyPasteSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "rustyPaste" + ] }, { "type": "object", - "required": [ - "githubIssue" - ], "properties": { "githubIssue": { - "$ref": "#/definitions/ReportDestinationGithubIssueSpec" + "$ref": "#/$defs/ReportDestinationGithubIssueSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "githubIssue" + ] }, { "type": "object", - "required": [ - "local" - ], "properties": { "local": { - "$ref": "#/definitions/ReportDestinationLocalSpec" + "$ref": "#/$defs/ReportDestinationLocalSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "local" + ] } ] }, @@ -414,28 +400,25 @@ "type": "object", "properties": { "analyze": { - "description": "Template to use when generating a bug without with analyze or intercept A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug without with analyze or intercept\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "doctor": { - "description": "Template to use when generating a bug report with `scope doctor` A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug report with `scope doctor`\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "title": { - "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is provided as a variable, which is the scope command run.", + "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is\nprovided as a variable, which is the scope command run.", "type": [ "string", "null" - ], - "nullable": true + ] } }, "additionalProperties": { @@ -451,33 +434,33 @@ "ReportLocationSpec": { "description": "Define where to upload the report to", "type": "object", - "required": [ - "destination" - ], "properties": { "additionalData": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `additionalData` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`additionalData` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "destination": { "description": "Destination the report should be uploaded to", - "$ref": "#/definitions/ReportDestinationSpec" + "$ref": "#/$defs/ReportDestinationSpec" }, "templates": { "description": "Templates to use when uploading a report", + "$ref": "#/$defs/ReportDestinationTemplates", "default": { "analyze": null, "doctor": null, "title": null - }, - "$ref": "#/definitions/ReportDestinationTemplates" + } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "destination" + ] }, "SkipSpec": { "anyOf": [ @@ -486,14 +469,14 @@ }, { "type": "object", - "required": [ - "command" - ], "properties": { "command": { "type": "string" } - } + }, + "required": [ + "command" + ] } ] }, @@ -503,98 +486,96 @@ { "description": "Current latest version of the resources.", "type": "string", - "enum": [ - "scope.github.com/v1alpha" - ] + "const": "scope.github.com/v1alpha" } ] }, "V1AlphaDoctorGroup": { "description": "Resource used to define a `ScopeDoctorGroup`.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/DoctorGroupKind" + "$ref": "#/$defs/DoctorGroupKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/DoctorGroupSpec" + "$ref": "#/$defs/DoctorGroupSpec" } }, - "additionalProperties": false - }, - "V1AlphaKnownError": { - "description": "Resource used to define a `ScopeKnownError`. A known error is a specific error that a user may run into.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaKnownError": { + "description": "Resource used to define a `ScopeKnownError`.\nA known error is a specific error that a user may run into.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/KnownErrorKind" + "$ref": "#/$defs/KnownErrorKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/KnownErrorSpec" + "$ref": "#/$defs/KnownErrorSpec" } }, - "additionalProperties": false - }, - "V1AlphaReportLocation": { - "description": "A `ScopeReportLocation` tells where to upload a report to.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaReportLocation": { + "description": "A `ScopeReportLocation` tells where to upload a report to.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/ReportLocationKind" + "$ref": "#/$defs/ReportLocationKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/ReportLocationSpec" + "$ref": "#/$defs/ReportLocationSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ] } } } \ No newline at end of file diff --git a/schema/v1alpha.com.github.scope.ScopeDoctorGroup.json b/schema/v1alpha.com.github.scope.ScopeDoctorGroup.json index 471f61a..74f5deb 100644 --- a/schema/v1alpha.com.github.scope.ScopeDoctorGroup.json +++ b/schema/v1alpha.com.github.scope.ScopeDoctorGroup.json @@ -3,59 +3,57 @@ "title": "V1AlphaDoctorGroup", "description": "Resource used to define a `ScopeDoctorGroup`.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/DoctorGroupKind" + "$ref": "#/$defs/DoctorGroupKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/DoctorGroupSpec" + "$ref": "#/$defs/DoctorGroupSpec" } }, "additionalProperties": false, - "definitions": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "$defs": { "DoctorCheckSpec": { - "description": "What needs to be checked before the action will run. `paths` will be checked first, then `commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", + "description": "What needs to be checked before the action will run. `paths` will be checked first, then\n`commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", "type": "object", "properties": { "commands": { "description": "A list of commands to execute to check the environment.", - "default": null, "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } }, "paths": { - "description": "A list of globs to check for changes. When the glob matches a new file, or the contents of the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working directory.", - "default": null, + "description": "A list of globs to check for changes. When the glob matches a new file, or the contents\nof the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working\ndirectory.", "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } } }, "additionalProperties": false @@ -65,17 +63,16 @@ "properties": { "extraContext": { "description": "Additional context for why they're being prompted for approval", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "text": { "description": "Yes/No question presented to the user", - "default": "", - "type": "string" + "type": "string", + "default": "" } }, "additionalProperties": false @@ -86,89 +83,84 @@ "properties": { "commands": { "description": "List of commands to run to fix the env.", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } }, "helpText": { "description": "Text to display when no command is provided / fails to fix the env.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "helpUrl": { "description": "Link to documentation to fix the issue.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "prompt": { "description": "When present, user will be prompted for approval before running the fix", - "default": null, "anyOf": [ { - "$ref": "#/definitions/DoctorFixPromptSpec" + "$ref": "#/$defs/DoctorFixPromptSpec" }, { "type": "null" } ], - "nullable": true + "default": null } }, "additionalProperties": false }, "DoctorGroupActionSpec": { - "description": "An action is a single step used to check in a group. This is most commonly used to build a series of tasks for a system, like `ruby`, `python`, and databases.", + "description": "An action is a single step used to check in a group. This is most commonly used to build a\nseries of tasks for a system, like `ruby`, `python`, and databases.", "type": "object", - "required": [ - "check", - "name" - ], "properties": { "check": { - "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs to be executed, or fail the action if no fix is provided. If a fix is specified, the check will re-execute to ensure that the fix applied correctly.", - "$ref": "#/definitions/DoctorCheckSpec" + "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs\nto be executed, or fail the action if no fix is provided. If a fix is specified, the check\nwill re-execute to ensure that the fix applied correctly.", + "$ref": "#/$defs/DoctorCheckSpec" }, "description": { "description": "A description of this specific action, used for information to the users.", "type": [ "string", "null" - ], - "nullable": true + ] }, "fix": { - "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only run when the `check` \"fails\".", + "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only\nrun when the `check` \"fails\".", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "name": { "description": "Name of the \"action\" used when reporting status to the users.", "type": "string" }, "required": { - "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults to `true`.", - "default": true, - "type": "boolean" + "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults\nto `true`.", + "type": "boolean", + "default": true } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "name", + "check" + ] }, "DoctorGroupKind": { "type": "string", @@ -177,64 +169,60 @@ ] }, "DoctorGroupSpec": { - "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to depend on other \"system\".", + "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to\ndepend on other \"system\".", "type": "object", - "required": [ - "actions" - ], "properties": { "actions": { "description": "A series of steps to check and fix for the group.", "type": "array", "items": { - "$ref": "#/definitions/DoctorGroupActionSpec" + "$ref": "#/$defs/DoctorGroupActionSpec" } }, "include": { - "description": "Change how a group is handled when building the dependency task graph. When set to `when-required`, the group will be ignored unless it's required by another dependency.", - "default": "by-default", - "$ref": "#/definitions/DoctorInclude" + "description": "Change how a group is handled when building the dependency task graph.\nWhen set to `when-required`, the group will be ignored unless it's required by another\ndependency.", + "$ref": "#/$defs/DoctorInclude", + "default": "by-default" }, "needs": { - "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish successfully, this group will not execute.", - "default": [], + "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish\nsuccessfully, this group will not execute.", "type": "array", + "default": [], "items": { "type": "string" } }, "reportExtraDetails": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `reportExtraDetails` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`reportExtraDetails` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "skip": { - "description": "Defines conditions under which the group should be skipped. `skip` can be a boolean, in which case the group will be skipped if `true`. Alternatively, it can be a command that will be run to determine if the group should be skipped. If the command returns a zero exit code, the group will be skipped. If the command returns a non-zero exit code, the group will not be skipped.", - "default": false, - "$ref": "#/definitions/SkipSpec" + "description": "Defines conditions under which the group should be skipped.\n`skip` can be a boolean, in which case the group will be skipped if `true`.\nAlternatively, it can be a command that will be run to determine if the group should\nbe skipped. If the command returns a zero exit code, the group will be skipped.\nIf the command returns a non-zero exit code, the group will not be skipped.", + "$ref": "#/$defs/SkipSpec", + "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "actions" + ] }, "DoctorInclude": { "description": "Configure how a groups will be used when determining the task graph.", "oneOf": [ { - "description": "Default option, the group will be included by default when determining which groups should run.", + "description": "Default option, the group will be included by default when determining which groups should\nrun.", "type": "string", - "enum": [ - "by-default" - ] + "const": "by-default" }, { "description": "Useful for shared configuration. The group will not run unless another group depends on it.", "type": "string", - "enum": [ - "when-required" - ] + "const": "when-required" } ] }, @@ -247,22 +235,17 @@ "KnownErrorSpec": { "description": "Definition of the known error", "type": "object", - "required": [ - "help", - "pattern" - ], "properties": { "fix": { "description": "An optional fix the user will be prompted to run.", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "help": { "description": "Text that the user can use to fix the issue", @@ -273,42 +256,44 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "help", + "pattern" + ] }, "ModelMetadata": { "type": "object", - "required": [ - "name" - ], "properties": { "annotations": { "description": "Annotations attach arbitrary non-identifying metadata to objects.", + "$ref": "#/$defs/ModelMetadataAnnotations", "default": { "scope.github.com/bin-path": null, - "scope.github.com/file-dir": null, - "scope.github.com/file-path": null, "working_dir": null - }, - "$ref": "#/definitions/ModelMetadataAnnotations" + } }, "description": { - "description": "Description of this resource, used when listing resources and helpful to inform users why the resource exists.", - "default": "Description not provided", - "type": "string" + "description": "Description of this resource, used when listing resources and helpful to inform users why\nthe resource exists.", + "type": "string", + "default": "Description not provided" }, "labels": { "description": "Key/value pairs, allows resources to be easily filtered from the CLI.", - "default": {}, "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "name": { - "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name, the one \"closest\" to the current working directory will take precedence.", + "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name,\nthe one \"closest\" to the current working directory will take precedence.", "type": "string" } - } + }, + "required": [ + "name" + ] }, "ModelMetadataAnnotations": { "type": "object", @@ -318,26 +303,23 @@ "type": [ "string", "null" - ], - "nullable": true + ] }, "working_dir": { "description": "The current working directory of the scope command, generated automatically.", "type": [ "string", "null" - ], - "nullable": true + ] } + }, + "additionalProperties": { + "type": "string" } }, "ReportDestinationGithubIssueSpec": { "description": "How to load the report to GitHub Issue", "type": "object", - "required": [ - "owner", - "repo" - ], "properties": { "owner": { "description": "`owner` of the repository for the issue", @@ -349,80 +331,84 @@ }, "tags": { "description": "A list of tags to be added to the issue", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "owner", + "repo" + ] }, "ReportDestinationLocalSpec": { "description": "Create a report that is only local", "type": "object", - "required": [ - "directory" - ], "properties": { "directory": { "description": "Directory to put the report into", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "directory" + ] }, "ReportDestinationRustyPasteSpec": { "description": "How to upload a report to RustyPaste", "type": "object", - "required": [ - "url" - ], "properties": { "url": { "description": "URL of RustyPaste", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "url" + ] }, "ReportDestinationSpec": { "oneOf": [ { "type": "object", - "required": [ - "rustyPaste" - ], "properties": { "rustyPaste": { - "$ref": "#/definitions/ReportDestinationRustyPasteSpec" + "$ref": "#/$defs/ReportDestinationRustyPasteSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "rustyPaste" + ] }, { "type": "object", - "required": [ - "githubIssue" - ], "properties": { "githubIssue": { - "$ref": "#/definitions/ReportDestinationGithubIssueSpec" + "$ref": "#/$defs/ReportDestinationGithubIssueSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "githubIssue" + ] }, { "type": "object", - "required": [ - "local" - ], "properties": { "local": { - "$ref": "#/definitions/ReportDestinationLocalSpec" + "$ref": "#/$defs/ReportDestinationLocalSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "local" + ] } ] }, @@ -430,28 +416,25 @@ "type": "object", "properties": { "analyze": { - "description": "Template to use when generating a bug without with analyze or intercept A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug without with analyze or intercept\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "doctor": { - "description": "Template to use when generating a bug report with `scope doctor` A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug report with `scope doctor`\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "title": { - "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is provided as a variable, which is the scope command run.", + "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is\nprovided as a variable, which is the scope command run.", "type": [ "string", "null" - ], - "nullable": true + ] } }, "additionalProperties": { @@ -467,33 +450,33 @@ "ReportLocationSpec": { "description": "Define where to upload the report to", "type": "object", - "required": [ - "destination" - ], "properties": { "additionalData": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `additionalData` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`additionalData` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "destination": { "description": "Destination the report should be uploaded to", - "$ref": "#/definitions/ReportDestinationSpec" + "$ref": "#/$defs/ReportDestinationSpec" }, "templates": { "description": "Templates to use when uploading a report", + "$ref": "#/$defs/ReportDestinationTemplates", "default": { "analyze": null, "doctor": null, "title": null - }, - "$ref": "#/definitions/ReportDestinationTemplates" + } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "destination" + ] }, "SkipSpec": { "anyOf": [ @@ -502,14 +485,14 @@ }, { "type": "object", - "required": [ - "command" - ], "properties": { "command": { "type": "string" } - } + }, + "required": [ + "command" + ] } ] }, @@ -519,98 +502,96 @@ { "description": "Current latest version of the resources.", "type": "string", - "enum": [ - "scope.github.com/v1alpha" - ] + "const": "scope.github.com/v1alpha" } ] }, "V1AlphaDoctorGroup": { "description": "Resource used to define a `ScopeDoctorGroup`.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/DoctorGroupKind" + "$ref": "#/$defs/DoctorGroupKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/DoctorGroupSpec" + "$ref": "#/$defs/DoctorGroupSpec" } }, - "additionalProperties": false - }, - "V1AlphaKnownError": { - "description": "Resource used to define a `ScopeKnownError`. A known error is a specific error that a user may run into.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaKnownError": { + "description": "Resource used to define a `ScopeKnownError`.\nA known error is a specific error that a user may run into.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/KnownErrorKind" + "$ref": "#/$defs/KnownErrorKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/KnownErrorSpec" + "$ref": "#/$defs/KnownErrorSpec" } }, - "additionalProperties": false - }, - "V1AlphaReportLocation": { - "description": "A `ScopeReportLocation` tells where to upload a report to.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaReportLocation": { + "description": "A `ScopeReportLocation` tells where to upload a report to.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/ReportLocationKind" + "$ref": "#/$defs/ReportLocationKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/ReportLocationSpec" + "$ref": "#/$defs/ReportLocationSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ] } } } \ No newline at end of file diff --git a/schema/v1alpha.com.github.scope.ScopeKnownError.json b/schema/v1alpha.com.github.scope.ScopeKnownError.json index dde7eac..27cb966 100644 --- a/schema/v1alpha.com.github.scope.ScopeKnownError.json +++ b/schema/v1alpha.com.github.scope.ScopeKnownError.json @@ -1,61 +1,59 @@ { "$schema": "https://json-schema.org/draft/2019-09/schema", "title": "V1AlphaKnownError", - "description": "Resource used to define a `ScopeKnownError`. A known error is a specific error that a user may run into.", + "description": "Resource used to define a `ScopeKnownError`.\nA known error is a specific error that a user may run into.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/KnownErrorKind" + "$ref": "#/$defs/KnownErrorKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/KnownErrorSpec" + "$ref": "#/$defs/KnownErrorSpec" } }, "additionalProperties": false, - "definitions": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "$defs": { "DoctorCheckSpec": { - "description": "What needs to be checked before the action will run. `paths` will be checked first, then `commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", + "description": "What needs to be checked before the action will run. `paths` will be checked first, then\n`commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", "type": "object", "properties": { "commands": { "description": "A list of commands to execute to check the environment.", - "default": null, "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } }, "paths": { - "description": "A list of globs to check for changes. When the glob matches a new file, or the contents of the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working directory.", - "default": null, + "description": "A list of globs to check for changes. When the glob matches a new file, or the contents\nof the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working\ndirectory.", "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } } }, "additionalProperties": false @@ -65,17 +63,16 @@ "properties": { "extraContext": { "description": "Additional context for why they're being prompted for approval", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "text": { "description": "Yes/No question presented to the user", - "default": "", - "type": "string" + "type": "string", + "default": "" } }, "additionalProperties": false @@ -86,89 +83,84 @@ "properties": { "commands": { "description": "List of commands to run to fix the env.", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } }, "helpText": { "description": "Text to display when no command is provided / fails to fix the env.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "helpUrl": { "description": "Link to documentation to fix the issue.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "prompt": { "description": "When present, user will be prompted for approval before running the fix", - "default": null, "anyOf": [ { - "$ref": "#/definitions/DoctorFixPromptSpec" + "$ref": "#/$defs/DoctorFixPromptSpec" }, { "type": "null" } ], - "nullable": true + "default": null } }, "additionalProperties": false }, "DoctorGroupActionSpec": { - "description": "An action is a single step used to check in a group. This is most commonly used to build a series of tasks for a system, like `ruby`, `python`, and databases.", + "description": "An action is a single step used to check in a group. This is most commonly used to build a\nseries of tasks for a system, like `ruby`, `python`, and databases.", "type": "object", - "required": [ - "check", - "name" - ], "properties": { "check": { - "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs to be executed, or fail the action if no fix is provided. If a fix is specified, the check will re-execute to ensure that the fix applied correctly.", - "$ref": "#/definitions/DoctorCheckSpec" + "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs\nto be executed, or fail the action if no fix is provided. If a fix is specified, the check\nwill re-execute to ensure that the fix applied correctly.", + "$ref": "#/$defs/DoctorCheckSpec" }, "description": { "description": "A description of this specific action, used for information to the users.", "type": [ "string", "null" - ], - "nullable": true + ] }, "fix": { - "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only run when the `check` \"fails\".", + "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only\nrun when the `check` \"fails\".", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "name": { "description": "Name of the \"action\" used when reporting status to the users.", "type": "string" }, "required": { - "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults to `true`.", - "default": true, - "type": "boolean" + "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults\nto `true`.", + "type": "boolean", + "default": true } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "name", + "check" + ] }, "DoctorGroupKind": { "type": "string", @@ -177,64 +169,60 @@ ] }, "DoctorGroupSpec": { - "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to depend on other \"system\".", + "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to\ndepend on other \"system\".", "type": "object", - "required": [ - "actions" - ], "properties": { "actions": { "description": "A series of steps to check and fix for the group.", "type": "array", "items": { - "$ref": "#/definitions/DoctorGroupActionSpec" + "$ref": "#/$defs/DoctorGroupActionSpec" } }, "include": { - "description": "Change how a group is handled when building the dependency task graph. When set to `when-required`, the group will be ignored unless it's required by another dependency.", - "default": "by-default", - "$ref": "#/definitions/DoctorInclude" + "description": "Change how a group is handled when building the dependency task graph.\nWhen set to `when-required`, the group will be ignored unless it's required by another\ndependency.", + "$ref": "#/$defs/DoctorInclude", + "default": "by-default" }, "needs": { - "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish successfully, this group will not execute.", - "default": [], + "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish\nsuccessfully, this group will not execute.", "type": "array", + "default": [], "items": { "type": "string" } }, "reportExtraDetails": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `reportExtraDetails` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`reportExtraDetails` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "skip": { - "description": "Defines conditions under which the group should be skipped. `skip` can be a boolean, in which case the group will be skipped if `true`. Alternatively, it can be a command that will be run to determine if the group should be skipped. If the command returns a zero exit code, the group will be skipped. If the command returns a non-zero exit code, the group will not be skipped.", - "default": false, - "$ref": "#/definitions/SkipSpec" + "description": "Defines conditions under which the group should be skipped.\n`skip` can be a boolean, in which case the group will be skipped if `true`.\nAlternatively, it can be a command that will be run to determine if the group should\nbe skipped. If the command returns a zero exit code, the group will be skipped.\nIf the command returns a non-zero exit code, the group will not be skipped.", + "$ref": "#/$defs/SkipSpec", + "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "actions" + ] }, "DoctorInclude": { "description": "Configure how a groups will be used when determining the task graph.", "oneOf": [ { - "description": "Default option, the group will be included by default when determining which groups should run.", + "description": "Default option, the group will be included by default when determining which groups should\nrun.", "type": "string", - "enum": [ - "by-default" - ] + "const": "by-default" }, { "description": "Useful for shared configuration. The group will not run unless another group depends on it.", "type": "string", - "enum": [ - "when-required" - ] + "const": "when-required" } ] }, @@ -247,22 +235,17 @@ "KnownErrorSpec": { "description": "Definition of the known error", "type": "object", - "required": [ - "help", - "pattern" - ], "properties": { "fix": { "description": "An optional fix the user will be prompted to run.", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "help": { "description": "Text that the user can use to fix the issue", @@ -273,42 +256,44 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "help", + "pattern" + ] }, "ModelMetadata": { "type": "object", - "required": [ - "name" - ], "properties": { "annotations": { "description": "Annotations attach arbitrary non-identifying metadata to objects.", + "$ref": "#/$defs/ModelMetadataAnnotations", "default": { "scope.github.com/bin-path": null, - "scope.github.com/file-dir": null, - "scope.github.com/file-path": null, "working_dir": null - }, - "$ref": "#/definitions/ModelMetadataAnnotations" + } }, "description": { - "description": "Description of this resource, used when listing resources and helpful to inform users why the resource exists.", - "default": "Description not provided", - "type": "string" + "description": "Description of this resource, used when listing resources and helpful to inform users why\nthe resource exists.", + "type": "string", + "default": "Description not provided" }, "labels": { "description": "Key/value pairs, allows resources to be easily filtered from the CLI.", - "default": {}, "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "name": { - "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name, the one \"closest\" to the current working directory will take precedence.", + "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name,\nthe one \"closest\" to the current working directory will take precedence.", "type": "string" } - } + }, + "required": [ + "name" + ] }, "ModelMetadataAnnotations": { "type": "object", @@ -318,26 +303,23 @@ "type": [ "string", "null" - ], - "nullable": true + ] }, "working_dir": { "description": "The current working directory of the scope command, generated automatically.", "type": [ "string", "null" - ], - "nullable": true + ] } + }, + "additionalProperties": { + "type": "string" } }, "ReportDestinationGithubIssueSpec": { "description": "How to load the report to GitHub Issue", "type": "object", - "required": [ - "owner", - "repo" - ], "properties": { "owner": { "description": "`owner` of the repository for the issue", @@ -349,80 +331,84 @@ }, "tags": { "description": "A list of tags to be added to the issue", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "owner", + "repo" + ] }, "ReportDestinationLocalSpec": { "description": "Create a report that is only local", "type": "object", - "required": [ - "directory" - ], "properties": { "directory": { "description": "Directory to put the report into", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "directory" + ] }, "ReportDestinationRustyPasteSpec": { "description": "How to upload a report to RustyPaste", "type": "object", - "required": [ - "url" - ], "properties": { "url": { "description": "URL of RustyPaste", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "url" + ] }, "ReportDestinationSpec": { "oneOf": [ { "type": "object", - "required": [ - "rustyPaste" - ], "properties": { "rustyPaste": { - "$ref": "#/definitions/ReportDestinationRustyPasteSpec" + "$ref": "#/$defs/ReportDestinationRustyPasteSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "rustyPaste" + ] }, { "type": "object", - "required": [ - "githubIssue" - ], "properties": { "githubIssue": { - "$ref": "#/definitions/ReportDestinationGithubIssueSpec" + "$ref": "#/$defs/ReportDestinationGithubIssueSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "githubIssue" + ] }, { "type": "object", - "required": [ - "local" - ], "properties": { "local": { - "$ref": "#/definitions/ReportDestinationLocalSpec" + "$ref": "#/$defs/ReportDestinationLocalSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "local" + ] } ] }, @@ -430,28 +416,25 @@ "type": "object", "properties": { "analyze": { - "description": "Template to use when generating a bug without with analyze or intercept A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug without with analyze or intercept\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "doctor": { - "description": "Template to use when generating a bug report with `scope doctor` A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug report with `scope doctor`\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "title": { - "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is provided as a variable, which is the scope command run.", + "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is\nprovided as a variable, which is the scope command run.", "type": [ "string", "null" - ], - "nullable": true + ] } }, "additionalProperties": { @@ -467,33 +450,33 @@ "ReportLocationSpec": { "description": "Define where to upload the report to", "type": "object", - "required": [ - "destination" - ], "properties": { "additionalData": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `additionalData` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`additionalData` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "destination": { "description": "Destination the report should be uploaded to", - "$ref": "#/definitions/ReportDestinationSpec" + "$ref": "#/$defs/ReportDestinationSpec" }, "templates": { "description": "Templates to use when uploading a report", + "$ref": "#/$defs/ReportDestinationTemplates", "default": { "analyze": null, "doctor": null, "title": null - }, - "$ref": "#/definitions/ReportDestinationTemplates" + } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "destination" + ] }, "SkipSpec": { "anyOf": [ @@ -502,14 +485,14 @@ }, { "type": "object", - "required": [ - "command" - ], "properties": { "command": { "type": "string" } - } + }, + "required": [ + "command" + ] } ] }, @@ -519,98 +502,96 @@ { "description": "Current latest version of the resources.", "type": "string", - "enum": [ - "scope.github.com/v1alpha" - ] + "const": "scope.github.com/v1alpha" } ] }, "V1AlphaDoctorGroup": { "description": "Resource used to define a `ScopeDoctorGroup`.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/DoctorGroupKind" + "$ref": "#/$defs/DoctorGroupKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/DoctorGroupSpec" + "$ref": "#/$defs/DoctorGroupSpec" } }, - "additionalProperties": false - }, - "V1AlphaKnownError": { - "description": "Resource used to define a `ScopeKnownError`. A known error is a specific error that a user may run into.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaKnownError": { + "description": "Resource used to define a `ScopeKnownError`.\nA known error is a specific error that a user may run into.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/KnownErrorKind" + "$ref": "#/$defs/KnownErrorKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/KnownErrorSpec" + "$ref": "#/$defs/KnownErrorSpec" } }, - "additionalProperties": false - }, - "V1AlphaReportLocation": { - "description": "A `ScopeReportLocation` tells where to upload a report to.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaReportLocation": { + "description": "A `ScopeReportLocation` tells where to upload a report to.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/ReportLocationKind" + "$ref": "#/$defs/ReportLocationKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/ReportLocationSpec" + "$ref": "#/$defs/ReportLocationSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ] } } } \ No newline at end of file diff --git a/schema/v1alpha.com.github.scope.ScopeReportLocation.json b/schema/v1alpha.com.github.scope.ScopeReportLocation.json index 87f494b..e36be27 100644 --- a/schema/v1alpha.com.github.scope.ScopeReportLocation.json +++ b/schema/v1alpha.com.github.scope.ScopeReportLocation.json @@ -3,59 +3,57 @@ "title": "V1AlphaReportLocation", "description": "A `ScopeReportLocation` tells where to upload a report to.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/ReportLocationKind" + "$ref": "#/$defs/ReportLocationKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/ReportLocationSpec" + "$ref": "#/$defs/ReportLocationSpec" } }, "additionalProperties": false, - "definitions": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "$defs": { "DoctorCheckSpec": { - "description": "What needs to be checked before the action will run. `paths` will be checked first, then `commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", + "description": "What needs to be checked before the action will run. `paths` will be checked first, then\n`commands`. If a `path` matches no files or the matching files have changed, the `command` will run.", "type": "object", "properties": { "commands": { "description": "A list of commands to execute to check the environment.", - "default": null, "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } }, "paths": { - "description": "A list of globs to check for changes. When the glob matches a new file, or the contents of the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working directory.", - "default": null, + "description": "A list of globs to check for changes. When the glob matches a new file, or the contents\nof the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working\ndirectory.", "type": [ "array", "null" ], + "default": null, "items": { "type": "string" - }, - "nullable": true + } } }, "additionalProperties": false @@ -65,17 +63,16 @@ "properties": { "extraContext": { "description": "Additional context for why they're being prompted for approval", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "text": { "description": "Yes/No question presented to the user", - "default": "", - "type": "string" + "type": "string", + "default": "" } }, "additionalProperties": false @@ -86,89 +83,84 @@ "properties": { "commands": { "description": "List of commands to run to fix the env.", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } }, "helpText": { "description": "Text to display when no command is provided / fails to fix the env.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "helpUrl": { "description": "Link to documentation to fix the issue.", - "default": null, "type": [ "string", "null" ], - "nullable": true + "default": null }, "prompt": { "description": "When present, user will be prompted for approval before running the fix", - "default": null, "anyOf": [ { - "$ref": "#/definitions/DoctorFixPromptSpec" + "$ref": "#/$defs/DoctorFixPromptSpec" }, { "type": "null" } ], - "nullable": true + "default": null } }, "additionalProperties": false }, "DoctorGroupActionSpec": { - "description": "An action is a single step used to check in a group. This is most commonly used to build a series of tasks for a system, like `ruby`, `python`, and databases.", + "description": "An action is a single step used to check in a group. This is most commonly used to build a\nseries of tasks for a system, like `ruby`, `python`, and databases.", "type": "object", - "required": [ - "check", - "name" - ], "properties": { "check": { - "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs to be executed, or fail the action if no fix is provided. If a fix is specified, the check will re-execute to ensure that the fix applied correctly.", - "$ref": "#/definitions/DoctorCheckSpec" + "description": "The `check` run before `fix` (if provided). A check is used to determine if the fix needs\nto be executed, or fail the action if no fix is provided. If a fix is specified, the check\nwill re-execute to ensure that the fix applied correctly.", + "$ref": "#/$defs/DoctorCheckSpec" }, "description": { "description": "A description of this specific action, used for information to the users.", "type": [ "string", "null" - ], - "nullable": true + ] }, "fix": { - "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only run when the `check` \"fails\".", + "description": "A fix defines how to fix the issue that a `check` is validating. When provided, will only\nrun when the `check` \"fails\".", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "name": { "description": "Name of the \"action\" used when reporting status to the users.", "type": "string" }, "required": { - "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults to `true`.", - "default": true, - "type": "boolean" + "description": "If false, the action is allowed to fail and let other actions in the group execute. Defaults\nto `true`.", + "type": "boolean", + "default": true } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "name", + "check" + ] }, "DoctorGroupKind": { "type": "string", @@ -177,64 +169,60 @@ ] }, "DoctorGroupSpec": { - "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to depend on other \"system\".", + "description": "Often used to describe how to fix a \"system\", like `ruby`, `python`, or databases. Able to\ndepend on other \"system\".", "type": "object", - "required": [ - "actions" - ], "properties": { "actions": { "description": "A series of steps to check and fix for the group.", "type": "array", "items": { - "$ref": "#/definitions/DoctorGroupActionSpec" + "$ref": "#/$defs/DoctorGroupActionSpec" } }, "include": { - "description": "Change how a group is handled when building the dependency task graph. When set to `when-required`, the group will be ignored unless it's required by another dependency.", - "default": "by-default", - "$ref": "#/definitions/DoctorInclude" + "description": "Change how a group is handled when building the dependency task graph.\nWhen set to `when-required`, the group will be ignored unless it's required by another\ndependency.", + "$ref": "#/$defs/DoctorInclude", + "default": "by-default" }, "needs": { - "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish successfully, this group will not execute.", - "default": [], + "description": "A list of `ScopeDoctorGroup` that are required for this group to execute. If not all finish\nsuccessfully, this group will not execute.", "type": "array", + "default": [], "items": { "type": "string" } }, "reportExtraDetails": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `reportExtraDetails` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`reportExtraDetails` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "skip": { - "description": "Defines conditions under which the group should be skipped. `skip` can be a boolean, in which case the group will be skipped if `true`. Alternatively, it can be a command that will be run to determine if the group should be skipped. If the command returns a zero exit code, the group will be skipped. If the command returns a non-zero exit code, the group will not be skipped.", - "default": false, - "$ref": "#/definitions/SkipSpec" + "description": "Defines conditions under which the group should be skipped.\n`skip` can be a boolean, in which case the group will be skipped if `true`.\nAlternatively, it can be a command that will be run to determine if the group should\nbe skipped. If the command returns a zero exit code, the group will be skipped.\nIf the command returns a non-zero exit code, the group will not be skipped.", + "$ref": "#/$defs/SkipSpec", + "default": false } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "actions" + ] }, "DoctorInclude": { "description": "Configure how a groups will be used when determining the task graph.", "oneOf": [ { - "description": "Default option, the group will be included by default when determining which groups should run.", + "description": "Default option, the group will be included by default when determining which groups should\nrun.", "type": "string", - "enum": [ - "by-default" - ] + "const": "by-default" }, { "description": "Useful for shared configuration. The group will not run unless another group depends on it.", "type": "string", - "enum": [ - "when-required" - ] + "const": "when-required" } ] }, @@ -247,22 +235,17 @@ "KnownErrorSpec": { "description": "Definition of the known error", "type": "object", - "required": [ - "help", - "pattern" - ], "properties": { "fix": { "description": "An optional fix the user will be prompted to run.", "anyOf": [ { - "$ref": "#/definitions/DoctorFixSpec" + "$ref": "#/$defs/DoctorFixSpec" }, { "type": "null" } - ], - "nullable": true + ] }, "help": { "description": "Text that the user can use to fix the issue", @@ -273,42 +256,44 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "help", + "pattern" + ] }, "ModelMetadata": { "type": "object", - "required": [ - "name" - ], "properties": { "annotations": { "description": "Annotations attach arbitrary non-identifying metadata to objects.", + "$ref": "#/$defs/ModelMetadataAnnotations", "default": { "scope.github.com/bin-path": null, - "scope.github.com/file-dir": null, - "scope.github.com/file-path": null, "working_dir": null - }, - "$ref": "#/definitions/ModelMetadataAnnotations" + } }, "description": { - "description": "Description of this resource, used when listing resources and helpful to inform users why the resource exists.", - "default": "Description not provided", - "type": "string" + "description": "Description of this resource, used when listing resources and helpful to inform users why\nthe resource exists.", + "type": "string", + "default": "Description not provided" }, "labels": { "description": "Key/value pairs, allows resources to be easily filtered from the CLI.", - "default": {}, "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "name": { - "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name, the one \"closest\" to the current working directory will take precedence.", + "description": "Name of the resource, needs to be unique across `kinds`. When two resources share a name,\nthe one \"closest\" to the current working directory will take precedence.", "type": "string" } - } + }, + "required": [ + "name" + ] }, "ModelMetadataAnnotations": { "type": "object", @@ -318,26 +303,23 @@ "type": [ "string", "null" - ], - "nullable": true + ] }, "working_dir": { "description": "The current working directory of the scope command, generated automatically.", "type": [ "string", "null" - ], - "nullable": true + ] } + }, + "additionalProperties": { + "type": "string" } }, "ReportDestinationGithubIssueSpec": { "description": "How to load the report to GitHub Issue", "type": "object", - "required": [ - "owner", - "repo" - ], "properties": { "owner": { "description": "`owner` of the repository for the issue", @@ -349,80 +331,84 @@ }, "tags": { "description": "A list of tags to be added to the issue", - "default": [], "type": "array", + "default": [], "items": { "type": "string" } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "owner", + "repo" + ] }, "ReportDestinationLocalSpec": { "description": "Create a report that is only local", "type": "object", - "required": [ - "directory" - ], "properties": { "directory": { "description": "Directory to put the report into", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "directory" + ] }, "ReportDestinationRustyPasteSpec": { "description": "How to upload a report to RustyPaste", "type": "object", - "required": [ - "url" - ], "properties": { "url": { "description": "URL of RustyPaste", "type": "string" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "url" + ] }, "ReportDestinationSpec": { "oneOf": [ { "type": "object", - "required": [ - "rustyPaste" - ], "properties": { "rustyPaste": { - "$ref": "#/definitions/ReportDestinationRustyPasteSpec" + "$ref": "#/$defs/ReportDestinationRustyPasteSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "rustyPaste" + ] }, { "type": "object", - "required": [ - "githubIssue" - ], "properties": { "githubIssue": { - "$ref": "#/definitions/ReportDestinationGithubIssueSpec" + "$ref": "#/$defs/ReportDestinationGithubIssueSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "githubIssue" + ] }, { "type": "object", - "required": [ - "local" - ], "properties": { "local": { - "$ref": "#/definitions/ReportDestinationLocalSpec" + "$ref": "#/$defs/ReportDestinationLocalSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "local" + ] } ] }, @@ -430,28 +416,25 @@ "type": "object", "properties": { "analyze": { - "description": "Template to use when generating a bug without with analyze or intercept A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug without with analyze or intercept\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "doctor": { - "description": "Template to use when generating a bug report with `scope doctor` A Jinja2 style template, to be included. The text should be in Markdown format. Scope injects `command` as the command that was run.", + "description": "Template to use when generating a bug report with `scope doctor`\nA Jinja2 style template, to be included. The text should be in Markdown format. Scope\ninjects `command` as the command that was run.", "type": [ "string", "null" - ], - "nullable": true + ] }, "title": { - "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is provided as a variable, which is the scope command run.", + "description": "Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is\nprovided as a variable, which is the scope command run.", "type": [ "string", "null" - ], - "nullable": true + ] } }, "additionalProperties": { @@ -467,33 +450,33 @@ "ReportLocationSpec": { "description": "Define where to upload the report to", "type": "object", - "required": [ - "destination" - ], "properties": { "additionalData": { - "description": "defines additional data that needs to be pulled from the system when reporting a bug. `additionalData` is a map of `string:string`, the value is a command that should be run. When a report is built, the commands will be run and automatically included in the report.", - "default": {}, + "description": "defines additional data that needs to be pulled from the system when reporting a bug.\n`additionalData` is a map of `string:string`, the value is a command that should be run.\nWhen a report is built, the commands will be run and automatically included in the report.", "type": "object", "additionalProperties": { "type": "string" - } + }, + "default": {} }, "destination": { "description": "Destination the report should be uploaded to", - "$ref": "#/definitions/ReportDestinationSpec" + "$ref": "#/$defs/ReportDestinationSpec" }, "templates": { "description": "Templates to use when uploading a report", + "$ref": "#/$defs/ReportDestinationTemplates", "default": { "analyze": null, "doctor": null, "title": null - }, - "$ref": "#/definitions/ReportDestinationTemplates" + } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "destination" + ] }, "SkipSpec": { "anyOf": [ @@ -502,14 +485,14 @@ }, { "type": "object", - "required": [ - "command" - ], "properties": { "command": { "type": "string" } - } + }, + "required": [ + "command" + ] } ] }, @@ -519,98 +502,96 @@ { "description": "Current latest version of the resources.", "type": "string", - "enum": [ - "scope.github.com/v1alpha" - ] + "const": "scope.github.com/v1alpha" } ] }, "V1AlphaDoctorGroup": { "description": "Resource used to define a `ScopeDoctorGroup`.", "type": "object", - "required": [ - "apiVersion", - "kind", - "metadata", - "spec" - ], "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/DoctorGroupKind" + "$ref": "#/$defs/DoctorGroupKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/DoctorGroupSpec" + "$ref": "#/$defs/DoctorGroupSpec" } }, - "additionalProperties": false - }, - "V1AlphaKnownError": { - "description": "Resource used to define a `ScopeKnownError`. A known error is a specific error that a user may run into.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaKnownError": { + "description": "Resource used to define a `ScopeKnownError`.\nA known error is a specific error that a user may run into.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/KnownErrorKind" + "$ref": "#/$defs/KnownErrorKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/KnownErrorSpec" + "$ref": "#/$defs/KnownErrorSpec" } }, - "additionalProperties": false - }, - "V1AlphaReportLocation": { - "description": "A `ScopeReportLocation` tells where to upload a report to.", - "type": "object", + "additionalProperties": false, "required": [ "apiVersion", "kind", "metadata", "spec" - ], + ] + }, + "V1AlphaReportLocation": { + "description": "A `ScopeReportLocation` tells where to upload a report to.", + "type": "object", "properties": { "apiVersion": { "description": "API version of the resource", - "$ref": "#/definitions/V1AlphaApiVersion" + "$ref": "#/$defs/V1AlphaApiVersion" }, "kind": { "description": "The type of resource.", - "$ref": "#/definitions/ReportLocationKind" + "$ref": "#/$defs/ReportLocationKind" }, "metadata": { - "description": "Standard set of options including name, description for the resource. Together `kind` and `metadata.name` are required to be unique. If there are duplicate, the resources \"closest\" to the execution dir will take precedence.", - "$ref": "#/definitions/ModelMetadata" + "description": "Standard set of options including name, description for the resource.\nTogether `kind` and `metadata.name` are required to be unique. If there are duplicate, the\nresources \"closest\" to the execution dir will take precedence.", + "$ref": "#/$defs/ModelMetadata" }, "spec": { "description": "Options for the resource.", - "$ref": "#/definitions/ReportLocationSpec" + "$ref": "#/$defs/ReportLocationSpec" } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ] } } } \ No newline at end of file diff --git a/src/models/core.rs b/src/models/core.rs index 55b251b..782ca84 100644 --- a/src/models/core.rs +++ b/src/models/core.rs @@ -10,12 +10,18 @@ pub const FILE_EXEC_PATH_ANNOTATION: &str = "scope.github.com/bin-path"; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, Builder, JsonSchema)] pub struct ModelMetadataAnnotations { - #[serde(rename = "scope.github.com/file-path")] + #[serde( + rename = "scope.github.com/file-path", + skip_serializing_if = "Option::is_none" + )] #[schemars(skip)] /// File path for the resource, generated automatically. pub file_path: Option, - #[serde(rename = "scope.github.com/file-dir")] + #[serde( + rename = "scope.github.com/file-dir", + skip_serializing_if = "Option::is_none" + )] #[schemars(skip)] /// Directory containing the resource, generated automatically. pub file_dir: Option, diff --git a/src/models/mod.rs b/src/models/mod.rs index 56d7762..c3c2610 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -86,7 +86,7 @@ where #[cfg(test)] fn create_and_validate( - schema_gen: &mut schemars::r#gen::SchemaGenerator, + schema_gen: &mut schemars::generate::SchemaGenerator, out_dir: &str, merged_schema: &str, ) -> anyhow::Result<()> { @@ -112,11 +112,8 @@ where } } -pub(crate) fn make_schema_generator() -> schemars::r#gen::SchemaGenerator { - let settings = schemars::r#gen::SchemaSettings::draft2019_09().with(|s| { - s.option_nullable = true; - }); - settings.into_generator() +pub(crate) fn make_schema_generator() -> schemars::generate::SchemaGenerator { + schemars::generate::SchemaSettings::draft2019_09().into_generator() } #[cfg(test)] diff --git a/src/models/v1alpha/report_location.rs b/src/models/v1alpha/report_location.rs index 70266c3..38282f4 100644 --- a/src/models/v1alpha/report_location.rs +++ b/src/models/v1alpha/report_location.rs @@ -51,7 +51,6 @@ pub enum ReportDestinationSpec { #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, Default)] #[serde(rename_all = "camelCase")] -#[schemars(deny_unknown_fields)] pub struct ReportDestinationTemplates { /// Title to use when creating the issue. This is a Jinja2 style template. `entrypoint` is /// provided as a variable, which is the scope command run. diff --git a/src/shared/directories.rs b/src/shared/directories.rs index 4668744..9bc13f7 100644 --- a/src/shared/directories.rs +++ b/src/shared/directories.rs @@ -102,39 +102,45 @@ pub fn cache() -> Option { mod tests { use super::*; use std::env; + use std::sync::Mutex; + + // Mutex to serialize tests that modify environment variables. + // Rust tests run in parallel by default, so we need to prevent concurrent + // modification of shared environment variables. + static ENV_MUTEX: Mutex<()> = Mutex::new(()); // Guard struct to ensure environment variables are restored even on panic - struct EnvGuard { + struct EnvGuard<'a> { var_name: String, original_value: Option, + _lock: std::sync::MutexGuard<'a, ()>, } - impl EnvGuard { + impl<'a> EnvGuard<'a> { fn new(var_name: &str) -> Self { + let lock = ENV_MUTEX.lock().unwrap(); let original_value = env::var(var_name).ok(); Self { var_name: var_name.to_string(), original_value, + _lock: lock, } } fn set(&self, value: &str) { - // SAFETY: This is test-only code. Tests using this are not run in parallel - // with other tests that depend on these environment variables. + // SAFETY: This is test-only code. Access is serialized by ENV_MUTEX. unsafe { env::set_var(&self.var_name, value) }; } fn remove(&self) { - // SAFETY: This is test-only code. Tests using this are not run in parallel - // with other tests that depend on these environment variables. + // SAFETY: This is test-only code. Access is serialized by ENV_MUTEX. unsafe { env::remove_var(&self.var_name) }; } } - impl Drop for EnvGuard { + impl Drop for EnvGuard<'_> { fn drop(&mut self) { - // SAFETY: This is test-only code. Tests using this are not run in parallel - // with other tests that depend on these environment variables. + // SAFETY: This is test-only code. Access is serialized by ENV_MUTEX. match &self.original_value { Some(value) => unsafe { env::set_var(&self.var_name, value) }, None => unsafe { env::remove_var(&self.var_name) },