diff --git a/src/schemas/json/github-issue-forms.json b/src/schemas/json/github-issue-forms.json index 510411a32d5..08374ac76d2 100644 --- a/src/schemas/json/github-issue-forms.json +++ b/src/schemas/json/github-issue-forms.json @@ -7,7 +7,14 @@ "type": { "description": "A form item type\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys", "type": "string", - "enum": ["checkboxes", "dropdown", "input", "markdown", "textarea"] + "enum": [ + "checkboxes", + "dropdown", + "input", + "markdown", + "textarea", + "upload" + ] }, "id": { "type": "string", @@ -26,6 +33,25 @@ }, "additionalProperties": false }, + "upload_validations": { + "title": "upload validations", + "description": "Upload validations\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#validations-for-upload", + "type": "object", + "properties": { + "required": { + "description": "Specify whether require a form item", + "type": "boolean", + "default": false + }, + "accept": { + "title": "accept", + "description": "A comma-separated list of file extensions that are accepted. If omitted, all supported file types are accepted.", + "type": "string", + "examples": [".png,.jpg,.gif,.log,.txt,.zip"] + } + }, + "additionalProperties": false + }, "assignee": { "type": "string", "maxLength": 39, @@ -2126,6 +2152,52 @@ }, "additionalProperties": false } + }, + { + "if": { + "properties": { + "type": { + "const": "upload" + } + } + }, + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + "title": "upload", + "description": "Upload\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#upload", + "type": "object", + "required": ["type", "attributes"], + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + "id": { + "$ref": "#/definitions/id", + "description": "Upload id\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys" + }, + "attributes": { + "title": "upload attributes", + "description": "Upload attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-for-upload", + "type": "object", + "required": ["label"], + "properties": { + "label": { + "$ref": "#/definitions/label", + "description": "A short upload description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-for-upload" + }, + "description": { + "$ref": "#/definitions/description", + "description": "A long upload description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-for-upload" + } + }, + "additionalProperties": false + }, + "validations": { + "$ref": "#/definitions/upload_validations" + } + }, + "additionalProperties": false + } } ] } diff --git a/src/test/github-issue-forms/official-example_3.yml b/src/test/github-issue-forms/official-example_3.yml new file mode 100644 index 00000000000..30e9801b687 --- /dev/null +++ b/src/test/github-issue-forms/official-example_3.yml @@ -0,0 +1,73 @@ +# yaml-language-server: $schema=../../schemas/json/github-issue-forms.json +name: Bug Report +description: File a bug report. +title: '[Bug]: ' +labels: ['bug', 'triage'] +projects: ['octo-org/1', 'octo-org/44'] +assignees: + - octocat +type: bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: input + id: contact + attributes: + label: Contact Details + description: How can we get in touch with you if we need more info? + placeholder: ex. email@example.com + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: 'A bug happened!' + validations: + required: true + - type: dropdown + id: version + attributes: + label: Version + description: What version of our software are you running? + options: + - 1.0.2 (Default) + - 1.0.3 (Edge) + default: 0 + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: What browsers are you seeing the problem on? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com). + options: + - label: I agree to follow this project's Code of Conduct + required: true + - type: upload + id: screenshots + attributes: + label: Upload screenshots + description: If applicable, add screenshots to help explain your problem. + validations: + required: false