Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbers in comments #922

Open
1 of 4 tasks
alexvoss opened this issue Sep 10, 2023 · 1 comment
Open
1 of 4 tasks

Numbers in comments #922

alexvoss opened this issue Sep 10, 2023 · 1 comment

Comments

@alexvoss
Copy link

Describe the bug

I am using yaml-language-server via RedHat's VSCode plugin and whenever I put a number (like '7') into a comment that occurs
at the beginning of the document, the schema does not get loaded:

image

The error also occurs when I have the comment above the document start line ('---') or when I add a %YAML directive. See this discussion of the behavior in the VSCode plugin.

This is not an issue with the plugin since I can reproduce the issue with vim:

image

Expected Behavior

The schema should be loaded and used to validate the YAML file.

Current Behavior

Instead, I get the error message Unable to parse content from '[absolute path]/testSchema.yaml': Parse error at offset 0.

Steps to Reproduce

  1. Create this schema file:
---
# a comment - that seems to work unless we add a number 123
title: Learning JSON/YAML schema 
type: object
properties:
  id: 
    type: string
  1. Create this YAML file in the same directory:
# yaml-language-server: $schema=./testSchema.yaml
---
id: "123"
description: "a short description"

Environment

  • Windows
  • Mac (and vim or VSCode)
  • Linux
  • other (please specify)
@alexvoss
Copy link
Author

alexvoss commented Sep 12, 2023

One more observation: the problem disappears when I add a modeline. Hope this helps.

# yaml-language-server: $schema=http://json-schema.org/draft-07/schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant