Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML Anchors and References Break Schema Validation and Suggestions #425

Open
1 of 4 tasks
svrx opened this issue Feb 8, 2021 · 6 comments
Open
1 of 4 tasks

YAML Anchors and References Break Schema Validation and Suggestions #425

svrx opened this issue Feb 8, 2021 · 6 comments
Assignees

Comments

@svrx
Copy link

svrx commented Feb 8, 2021

Describe the bug

When user anchors or references in CloudFormation YAML files, schemas stops working when anchors/references are used.

Expected Behavior

It works as normal.

Current Behavior

Following error keeps repeating as elements are hovered.

Error thrown while requesting schema "Error: end of the stream or a document separator is expected" when calling the registered contributor "cloudformation"

Steps to Reproduce

  1. Add an anchor to any element
...
 Tags: &tags
   - Key: Application
     Value: MyApp
...

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
@evidolob evidolob added the bug label Feb 8, 2021
@evidolob evidolob self-assigned this Feb 23, 2021
@evidolob
Copy link
Collaborator

@svrx Can you share more info on this?
I cannot reproduce this:
Screenshot 2021-02-24 at 14 53 38

Do you use only vscode-yaml ? Or some other extension which depends on it?

@evidolob evidolob removed the bug label Feb 24, 2021
@svrx
Copy link
Author

svrx commented Mar 2, 2021

Thanks for investigating.
I've investigated the issue further on my setup and have been able to narrow down to some interaction with kddejong.vscode-cfn-lint.

Will bring to maintainers awareness.

Is there anything you can check on your side?
Otherwise feel free to close this issue for now.

@evidolob
Copy link
Collaborator

evidolob commented Mar 2, 2021

It would be nice, if you can share yaml, on which you got validation broken, to let me check more deeply.

@svrx
Copy link
Author

svrx commented Mar 4, 2021

Something as simple as this is enough.

AWSTemplateFormatVersion: '2010-09-09' 
Resources:
  ServiceCluster:
    Type: AWS::ECS::Cluster
    Properties:
      ClusterName: ClusterName
      Tags: &tags
        - Key: Application
          Value: AppName
        - Key: ApplicationRole
          Value: FrontEnd
  WebLoadBalancer:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: LBName
      Type: application
      Tags: *tags

As soon as the anchor (&tags) is added, following error start appearing anytime an element is hovered.
image

@evidolob
Copy link
Collaborator

evidolob commented Mar 4, 2021

It is bug kddejong.vscode-cfn-lint in as they use node-yaml-parser to parse yaml and it seems it not support yaml anchor's.
I will investigate more next week, we need to improve our behavior in case if contributing extension fails.

@svrx
Copy link
Author

svrx commented Mar 4, 2021

Thanks. Already opened issue with then about the issue.
aws-cloudformation/cfn-lint-visual-studio-code#158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants