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.

how to use my own local schema?

See original GitHub issue

I’ve read the docs a few times and having trouble getting going with schema validation. I want to have a custom schema to validate against for something I’m building.

Following associating a schema

I have this in my .vscode directory

{
  "yaml.schemas": {
    "../cdn/schemas/storyline.json": [
      "../cdn/story*/story.yaml"
    ]
  }
}

so those rel-paths should point to the files to apply the schema to

image

So given a very basic schema:

“…/cdn/schemas/storyline.json”

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "storyline",
  "definitions": {
    "story": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "name of the story"
        },
        "cname": {
          "type": "string",
          "description": "canonical computer readable name"
        }
      }
    }
  }
}

It should validate against a file like this

…/cdn/story-test/story.yaml

story:
  name: aa
  cname: 123

But I can’t tell if anything is working. When I type I don’t get any suggestions…

image

And there are no commands for yaml added to the command palette. image

I’ve restarted VSCode

image

and the extension is running.

What am I doing wrong ¯_(ツ)_/¯

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dcsancommented, Jul 27, 2020

cool! I got it working now, thanks for your help! This might serve as a useful example for anyone else getting started…

0reactions
JPinkneycommented, Jul 27, 2020

Also, in the next version you’ll be able to add a comment at the top of the file that looks like:

# yaml-language-server: $schema=my_schema_location
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ultimate How-to Guide for Local Business Schema Markup
We recommend our own tools, the Schema App Editor and Schema App Highlighter, but there are many different options out there.
Read more >
Local SEO Schema: A Complete Guide To Local Markup ...
Optimize your local business' website by applying properly formatted and relevant structured data. Get started easily with this guide.
Read more >
Getting Started with Schema for Local Businesses
This can be done by clicking on the page you want to add schema too, hitting the gear icon, then clicking advanced. From...
Read more >
What Is Schema Markup? Beginner's Guide to Structured Data
Schema markup is a structured data vocabulary that allows Google to serve better results. We'll discuss different kinds of schema and how to...
Read more >
Build schemas & taxonomies from scratch in Sanity.io
Build schemas & taxonomies from scratch in Sanity.io ; // schema.js // First, we must import the schema creator · // Then import...
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