AWS SAM JSON Schema #2645
Replies: 5 comments 5 replies
-
I get some error on my SAM templates and the tooltip not provide information. |
Beta Was this translation helpful? Give feedback.
-
it should also be possible to manually select the json schema from the vscode status bar, but it seems like that is not working. tracked in aws/aws-toolkit-vscode#3012 |
Beta Was this translation helpful? Give feedback.
-
We are looking into a resolution but if you want a temporary workaround should you encounter the above issue, locate AWS Toolkit in your installed packages and you can temporarily disable, reload vscode and you can then use the schema as described. |
Beta Was this translation helpful? Give feedback.
-
How can I reference to external file has the definition of the resources in SAM template with json format |
Beta Was this translation helpful? Give feedback.
-
Introduction
We now provide a JSON Schema for AWS SAM templates (see #1133 for the original issue). It enhances the template authoring experience by enabling autocompletion, validation, and viewing documentation directly from your IDE. It supports all SAM and AWS CloudFormation resources.
Here's what it looks like in Visual Studio Code:
JSON Schema files
Autocompletion, validation, and documentation from your IDE
Using AWS Toolkit for Visual Studio Code
Install AWS Toolkit for Visual Studio Code and open any SAM template. It uses the SAM JSON Schema under the hood.
Using the Visual Studio Code YAML extension
Install the YAML extension.
Paste the following at the top of your SAM template:
# yaml-language-server: $schema=https://raw.githubusercontent.com/aws/serverless-application-model/main/samtranslator/schema/schema.json
Using Visual Studio Code JSON Schema support
If your template is in JSON format, add the following at the root of the template:
Technical details
See here for more details.
Limitations
AWS::LanguageExtensions
to modify properties of a SAM resource.AccessLogSettings
) are passed directly to underlying CloudFormation resources. This is being addressed in feat: scaffolding for improved pass-throughs in schema #3055.Beta Was this translation helpful? Give feedback.
All reactions