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

added Fn::Transport to Resources.resources on validation schema #8337

Merged
merged 2 commits into from Oct 6, 2020

Conversation

rzaldana
Copy link
Contributor

@rzaldana rzaldana commented Oct 2, 2020

Closes: #8300

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2020

Codecov Report

Merging #8337 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8337      +/-   ##
==========================================
- Coverage   88.01%   88.01%   -0.01%     
==========================================
  Files         249      249              
  Lines        9306     9305       -1     
==========================================
- Hits         8191     8190       -1     
  Misses       1115     1115              
Impacted Files Coverage Δ
lib/plugins/aws/provider/awsProvider.js 93.04% <ø> (ø)
lib/classes/Variables.js 99.72% <0.00%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc34140...5ea6464. Read the comment docs.

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@zaldanaraul great thanks for that! Please see my comment, and let me know what you think

@@ -796,6 +811,9 @@ class AwsProvider {
// See also https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html
Resources: {
type: 'object',
properties: {
$ref: '#/definitions/awsCfTransform/properties',
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested that it works as intended?

If I see correctly it translates to:

Resources: {
  type: 'object', 
  properties: {
    type: 'object',
    properties: {...}
  },
  ...
}

And that looks invalid (note that AJV unfortunately does not notify on unrecognized properties in Schema, it simply ignores them).

I think we don't have to introduce awsCfTransform definition (no reusabilty use case at this point), so we can fix it simply by putting definition inline

Copy link
Contributor Author

@rzaldana rzaldana Oct 5, 2020

Choose a reason for hiding this comment

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

It did work in my tests. In this case, because the JSON Pointer is to awscfTransform/properties and not just awscfTransform, it would translate to:

Resources: {
  type: 'object', 
  properties: {
    type: 'object',
    properties:
      'Fn::Transform': {...}
  },
  ...
}

However, if there is no reusability use case I'll just put the properties inline.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, sorry, didn't read carefully that per path right object is pointed.

Anyway we usually do not generalize until there's a use case for it. Thanks for update!

@rzaldana rzaldana requested a review from medikoo October 5, 2020 13:58
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @zaldanaraul !

@medikoo medikoo merged commit 11a9d37 into serverless:master Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support 'Fn::Transform' 'AWS::Include'
3 participants