question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SAM json schema: cannot change schema in template.yaml file

See original GitHub issue

Problem

Cannot manually select a different json schema in SAM template.yaml.

Steps to reproduce the issue

  1. Choose a different schema from the status bar:
    • image
  2. 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:open
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jpinkney-awscommented, Nov 25, 2022

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.schemas setting.

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

0reactions
hoffacommented, Nov 29, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found