IntelliSense in Amazon ECS task-definition files: JSON schema has incorrect regex pattern
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
**Describe the bug**
In using IntelliSense in Amazon ECS task-definition files, AWS Toolkit for Visual Studio Code gives incorrect warnings about tag names and values below:
> String does not match the pattern of "^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$".
> One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
AWS Toolkit for Visual Studio Code refers to the JSON schema below, and it seems that only `tags.name` and `tags.key` are set to pattern. However, I think JSON Schema does not support Unicode Categories like `\\p{L}`.
SEE ALSO:
- Understanding JSON Schema [PDF]: https://json-schema.org/understanding-json-schema/UnderstandingJSONSchema.pdf#page=22
- ECS task-definition JSON schema: https://ecs-intellisense.s3-us-west-2.amazonaws.com/task-definition/schema.json
```json
"tags": {
"description": "The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. The following basic restrictions apply to tags: Maximum number of tags per resource - 50 For each resource, each tag key must be unique, and each tag key can have only one value. Maximum key length - 128 Unicode characters in UTF-8 Maximum value length - 256 Unicode characters in UTF-8 If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit. ",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"description": "One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.",
"type": "string",
"maxLength": 128,
"minLength": 1,
"pattern": "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"
},
"value": {
"description": "The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).",
"type": "string",
"maxLength": 256,
"minLength": 0,
"pattern": "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"
}
},
"additionalProperties": false
},
"additionalProperties": false,
"maxLength": 50,
"minLength": 0
},
```
**To Reproduce**
Of course, I checked that this `ecs-task-def.json` can `aws ecs register-task-definition`.
`ecs-task-def.json` below to reproduce:
```json:ecs-task-def.json
{
"family": "testapp",
"executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
"taskRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
"networkMode": "awsvpc",
"cpu": "256",
"memory": "512",
"containerDefinitions": [
{
"name": "app",
"image": "public.ecr.aws/nginx/nginx:1.21",
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/aws/fargate/testapp",
"awslogs-region": "ap-northeast-1",
"awslogs-stream-prefix": "app"
}
}
}
],
"requiresCompatibilities": [
"FARGATE"
],
"tags": [
{
"key": "KEY",
"value": "VALUE"
}
]
}
```
**Expected behavior**
No error.
**Screenshots**

**Desktop (please complete the following information):**
- OS: Linux x64 5.10.16.3-microsoft-standard-WSL2 (on Windows 10 21H1 19043.1288)
- Visual Studio Code Version: 1.61.2 (user setup)
- AWS Toolkit Version: 1.32.0
Contributor guide
Research direction
Start with the ECS task-definition schema linked in the issue and the inline ecs-task-def.json reproduction, focusing on the tags.key and tags.value patterns. Confirm how VS Code 1.61.2 and AWS Toolkit 1.32.0 validate those patterns; done means valid tag keys and values no longer produce IntelliSense warnings while the task definition remains registerable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, json, typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100