serverless / serverless-python-requirements

⚡️🐍📦 Serverless plugin to bundle Python packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reference.json mismatch for slimPatterns

alanwilter opened this issue · comments

Here says:

custom:
  pythonRequirements:
    slim: true
    slimPatterns:
      - '**/*.egg-info*'

But my vscode is complaining with

[{
	"resource": ".../serverless.yml",
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 8,
	"message": "Incorrect type. Expected \"string\".",
	"source": "yaml-schema: Serverless Framework Configuration",
	"startLineNumber": 85,
	"startColumn": 7,
	"endLineNumber": 101,
	"endColumn": 1
}]

And if I see the reference.json for slimPatterns:

        "slimPatterns": {
          "type": "string",
          "description": "https://github.com/serverless/serverless-python-requirements#custom-removal-patterns"
        },

I can see something is wrong. Now what's wrong? Should it be an array? like:

        "slimPatterns": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },

or how to do it with strings?

Hello @alanwilter - thanks a lot for reporting. You mention that your "VSCode is complaining" - could you please elaborate more? What exactly are you using along with VSCode to check the configuration? I'm personally not a VSCode user so it's hard for me to say more at this point.

From serverless.yml in VSCode:

Wiggled red lines -> problems!
Screenshot 2022-10-22 at 08 13 13

Hovering over -> shows the reason
Screenshot 2022-10-22 at 08 17 22

Right-click takes me to the reference.json
Screenshot 2022-10-22 at 08 21 02

Screenshot 2022-10-22 at 08 23 21

Now, I don't know where reference.json comes from. If from serverless-python-requirements or from a VSCode plugin.

Ok, it's not serverless-python-requirements, it's in

  "$schema": "https://json-schema.org/draft-07/schema#",
  "title": "Serverless Framework Configuration",
  "description": "Schema for serverless framework configuration files",
  "fileMatch": ["serverless.yml", "serverless.yaml"],

Hey @alanwilter - it looks like it's an issue with the VSCode plugin and it would be better to report it at that plugin's repo - unfortunately I don't know which plugin are you using exactly.

Glad to hear that, thanks for closing the ticket @alanwilter 🙇