SAM/CFN json schema: handle of intrinsic functions
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
**Is your feature request related to a problem? Please describe.**
Right now when we use [intrinsic functions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) in YAML we often get error messages such as:
`Incorrect type. Expected "string".`
E.g.
```
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
sample:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Join [ ":", [ a, b, c ] ] <- Incorrect type. Expected "string"
```
from https://github.com/aws/aws-toolkit-vscode/issues/1974#issuecomment-922405837.
This issue can also be seen a couple times in: https://github.com/aws/aws-toolkit-vscode/issues/1978.
We should work on improving support for intrinsic functions (either in this extension or through VSCode-YAML) so that all YAML is successfully validated.
**Describe the solution you'd like**
There's a couple quick ideas that might help:
1. Work with VSCode-YAML to create an API to disable validation when it sees certain intrinsic types
2. Work with VSCode-YAML to create an API to allow us to provide custom validation on intrinsic values. This means we would be able to validate whether or not an intrinsic function is behaving correctly and provide feedback to YAML writers if there might be an error
**Describe alternatives you've considered**
See if we can somehow handle intrinsic functions better through this extension
**Additional context**
Intrinsic function reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
Contributor guide
Research direction
Start by reviewing the reported examples and the intrinsic function reference, then inspect the validation behavior in VSCode-YAML and the related aws-toolkit-vscode issues 1974 and 1978. Determine whether an API for disabling or customizing intrinsic-value validation is feasible; done means valid intrinsic functions no longer produce incorrect type errors while invalid values can still receive useful feedback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, vscode
- Domain
- cloud, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100