SAM json schema: cannot change schema in template.yaml file
See original GitHub issueProblem
Cannot manually select a different json schema in SAM template.yaml.
Steps to reproduce the issue
- Choose a different schema from the status bar:
- the schema is ignored and the selection remains
aws://sam.schema.json
Expected behavior
System details (run the AWS: About Toolkit command)
- OS:
- Visual Studio Code version:
- AWS Toolkit version:
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
sam.schema.json: Multiple valid CloudFormation constructs ...
Describe the bug Many advanced CloudFormation features are not currently recognized by the sam.schema.json JSON schema.
Read more >AWS SAM template anatomy - AWS Documentation
An AWS SAM template file closely follows the format of an AWS CloudFormation template file, which is described in Template anatomy in the...
Read more >Understanding JSON Schema
JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its.
Read more >AWS Lambda Guide - Serverless.yml Reference
schemas : global-model: # JSON Schema. schema: ${file(schema.json)} ... Custom request mapping templates that overwrite default templates. template:.
Read more >AWS SAM Template Fails to Create Configurations for API ...
The problem is you have duplicated the Resources key in the template. I recommend always using the yamllint utility on your SAM templates, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found


The way the VSCode-YAML API works is, given an intellisense action (hover, validation, completion, etc), it will query all the extensions that are currently registered to use it’s API and then ask them if this file is supported by their extension.
E.g. In our case, we see a SAM file in VSCode so we tell VSCode-YAML that we are the ones who should be providing the schema for this file.
Once VSCode-YAML see’s that an extension is ready and available to send a schema for the given file, it disables all other modes of settings the schema (modeline,
yaml.schemas, etc) for that file.This is by design, since theoretically an extension should be able to recognize their files and then provide support for them, that way users don’t have to manually specify schemas using the modeline or the
yaml.schemassetting.The problem here is we aren’t able to easily override the way the VSCode-YAML API works. So right now, the VSCode-YAML API sees that our extension will send back the schema for the given SAM file and then disables all other ways to set the schema
For context, this is affecting https://github.com/aws/serverless-application-model/discussions/2645