Skip to content

chore(cfnspec): improve error meesaging when spec validation fails#16991

Merged
mergify[bot] merged 1 commit intomasterfrom
nija-at/cfnspec-errormsg
Oct 15, 2021
Merged

chore(cfnspec): improve error meesaging when spec validation fails#16991
mergify[bot] merged 1 commit intomasterfrom
nija-at/cfnspec-errormsg

Conversation

@nija-at
Copy link
Copy Markdown
Contributor

@nija-at nija-at commented Oct 15, 2021

Print the node of the CFN spec where validation fails, so the erroneous
part of the spec can be located.

Currently, when a Property in a PropertyType has two "Type" fields
specified, the message looks like below. Only the resource type being
validated is printed.

FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary")

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]

With this change, the message will look like -

FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary") › PropertyType AWS::Synthetics::Canary.ArtifactConfig › Property S3Encryption

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Print the node of the CFN spec where validation fails, so the erroneous
part of the spec can be located.

Currently, when a Property in a PropertyType has two "Type" fields
specified, the message looks like below. Only the resource type being
validated is printed.

```
FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary")

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]
```

With this change, the message will look like -

```
FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary") › PropertyType AWS::Synthetics::Canary.ArtifactConfig › Property S3Encryption

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]
```
@nija-at nija-at requested a review from rix0rrr October 15, 2021 06:18
@nija-at nija-at self-assigned this Oct 15, 2021
@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Oct 15, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 15, 2021
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 85fb963
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Copy Markdown
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see what you did, added describes to show where the error is cropping up.

That's a good start. I would say that the "empty array expected, found Type" is still quite cryptic, but I suppose it's a start.

@mergify mergify bot merged commit fbb49fe into master Oct 15, 2021
@mergify mergify bot deleted the nija-at/cfnspec-errormsg branch October 15, 2021 08:26
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 15, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…ws#16991)

Print the node of the CFN spec where validation fails, so the erroneous
part of the spec can be located.

Currently, when a Property in a PropertyType has two "Type" fields
specified, the message looks like below. Only the resource type being
validated is printed.

```
FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary")

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]
```

With this change, the message will look like -

```
FAIL test/filtered-specification.test.js (8.522 s)
  filteredSpecification("AWS::Synthetics::Canary") › PropertyType AWS::Synthetics::Canary.ArtifactConfig › Property S3Encryption

  expect(received).toEqual(expected)

  - Expected  - 1
  + Received  + 3

  - Array []
  + Array [
  +   "Type",
  + ]
```


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants