json-schema
json-schema copied to clipboard
Support for variable references
Unless a property accepts the type string with no applicable validation constraints, variable references will cause validation errors. This can be seen in the aws-ffmpeg-layer example:

According to the Serverless Variables page, there are at least half a dozen variable formats. The CloudFormation reference is briefly mentioned in this article.
I'm wondering what the best approach would be here, would it be feasible to use a pattern to match {...}/${...} values similar to the Serverless.FilePath sub schema?
@dnicolson we have the Expression in defintion, would that be a better solution?
@KillDozerX2 I am not sure what you mean, where is this Expression?
I've also got this problem. I'm enabled event schedules based on stage.
custom:
scheduleEnabled:
prod: true
dev: false
functions:
move-to-tm:
handler: dist/move-to-tm.default
timeout: 30
events:
- schedule:
rate: rate(7 days)
enabled: ${self:custom.scheduleEnabled.${opt:stage, self:provider.stage}}

@Sparticuz yeah, we've been facing issues with variable reference.
One solution is to work with @pavelvlasov and his vscode intellisense formatter to load the value using language server and then try to validate it agains the schema.
Watch this issue:- https://github.com/threadheap/serverless-ide-vscode/issues/169
Is there a workaround? I looked at https://github.com/threadheap/serverless-ide-vscode/issues/169 which mentions a fork. But how do we use it?
Install the extension in vscode?
@KillDozerX2 installing the Serverless IDE extension doesn't appear to have any effect. Is there something else that needs to be done?
Hi @KillDozerX2, could you please provide an update on this?
From the first comment, it is unclear what the status of this issue is.
HI @dnicolson Trying to get in touch with author of Serverless IDE still. My expectation is that the schema will be validated only after the variables reference is completed. I don't have much experience with a VSCode extensions, but would be nice to get some help in this area. Or better still to create a new extension for Serverless Framework alone. I will reopen this issue to get feedback from people.