{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/web-app-manifest/_shared/latest--web-manifest-share-target.json",
  "title": "JSON schema for Web Application manifest files with Web Share Target and Web Share Target Level 2 extensions",
  "x-lintel": {
    "source": "https://json.schemastore.org/web-manifest-share-target.json",
    "sourceSha256": "cc73a3e212a1fef232b29ccdca06421216f66443f184432b61e23e62f3c274cf"
  },
  "type": "object",
  "properties": {
    "share_target": {
      "$ref": "#/$defs/share_target",
      "description": "Declares the application to be a web share target, and describes how it receives share data."
    }
  },
  "id": "https://json.schemastore.org/web-manifest-share-target.json",
  "$defs": {
    "share_target": {
      "type": "object",
      "description": "Describes how the application receives share data.",
      "properties": {
        "action": {
          "description": "The URL for the web share target.",
          "type": "string"
        },
        "method": {
          "description": "The HTTP request method for the web share target.",
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "get",
            "post"
          ],
          "default": "GET"
        },
        "enctype": {
          "description": "This member specifies the encoding in the share request.",
          "type": "string",
          "enum": [
            "application/x-www-form-urlencoded",
            "multipart/form-data",
            "APPLICATION/X-WWW-FORM-URLENCODED",
            "MULTIPART/FORM-DATA"
          ],
          "default": "application/x-www-form-urlencoded"
        },
        "params": {
          "$ref": "#/$defs/share_target_params",
          "description": "Specifies what data gets shared in the request."
        }
      },
      "required": [
        "action",
        "params"
      ]
    },
    "share_target_params": {
      "type": "object",
      "description": "Specifies what data gets shared in the request.",
      "properties": {
        "title": {
          "description": "The name of the query parameter used for the title of the document being shared.",
          "type": "string"
        },
        "text": {
          "description": "The name of the query parameter used for the message body, made of arbitrary text.",
          "type": "string"
        },
        "url": {
          "description": "The name of the query parameter used for the URL string referring to a resource being shared.",
          "type": "string"
        },
        "files": {
          "description": "Description of how the application receives files from share requests.",
          "oneOf": [
            {
              "$ref": "#/$defs/share_target_files"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/share_target_files"
              }
            }
          ]
        }
      }
    },
    "share_target_files": {
      "type": "object",
      "description": "Description of how the application receives files from share requests.",
      "properties": {
        "name": {
          "description": "The name of the form field used to share the files.",
          "type": "string"
        },
        "accept": {
          "description": "Sequence of accepted MIME types or file extensions can be shared to the application.",
          "oneOf": [
            {
              "type": "string",
              "pattern": "^((\\..*)|(.*/.*))$"
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^((\\..*)|(.*/.*))$"
              }
            }
          ]
        }
      },
      "required": [
        "name",
        "accept"
      ]
    }
  }
}
