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

Schema validation for Fn::Join flags empty delimiter #8344

Closed
glb opened this issue Oct 5, 2020 · 1 comment · Fixed by #8349
Closed

Schema validation for Fn::Join flags empty delimiter #8344

glb opened this issue Oct 5, 2020 · 1 comment · Fixed by #8349

Comments

@glb
Copy link
Contributor

glb commented Oct 5, 2020

The schema validation for Fn::Join seems incorrect. It is perfectly valid for the delimiter string for Fn::Join to be the empty string.

If a delimiter is the empty string, the set of values are concatenated with no delimiter.

(link)

Yet the tool complains when validating:

Serverless: Configuration warning at 'functions.example.environment.EXAMPLE['Fn::Join'][0]': should NOT be shorter than 1 characters

This is because the schema says that the minimum length for the delimiter parameter is 1:

items: [{ type: 'string', minLength: 1 }, { type: 'array' }],

serverless.yml
service: example
  
frameworkVersion: ">=2.0.0 <3.0.0"

provider:
  name: aws

functions:
  example:
    handler: example.example
    environment:
      EXAMPLE:
        "Fn::Join":
          - ""
          - - "ex"
            - "ample"
sls package --verbose output
Serverless: Configuration warning at 'functions.example.environment.EXAMPLE['Fn::Join'][0]': should NOT be shorter than 1 characters
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:  
Serverless: Packaging service...
Serverless: Excluding development dependencies...
 
  Serverless Error ---------------------------------------
 
  No file matches include / exclude patterns
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              14.7.0
     Framework Version:         2.4.0
     Plugin Version:            4.0.4
     SDK Version:               2.3.2
     Components Version:        3.2.1

Installed version

Framework Core: 2.4.0
Plugin: 4.0.4
SDK: 2.3.2
Components: 3.2.1

Suggested fix: remove the minLength: 1 for the first parameter to Fn::Join.

@medikoo
Copy link
Contributor

medikoo commented Oct 6, 2020

@glb indeed, thanks for reporting that! PR with a fix is welcome

(cc @fredericbarthelet)

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

Successfully merging a pull request may close this issue.

2 participants