redhat-developer / redhat-developer/yaml-language-server

TypeError: Cannot create property 'url' on string 'object'

Open
#916 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

Describe the bug

I'm using monaco-yaml with react-monaco-editor, and I'm seeing the below error in the console and validation, schema-based suggestions are not working. The error is also displayed every time the YAML is edited.

TypeError: Cannot create property 'url' on string 'object'
    at _validateObjectNode (https://localhost:8181/yaml.worker.a42e65.js:36085:32)
    at validate2 (https://localhost:8181/yaml.worker.a42e65.js:35533:7)
    at testAlternatives (https://localhost:8181/yaml.worker.a42e65.js:35610:9)
    at _validateNode (https://localhost:8181/yaml.worker.a42e65.js:35654:7)
    at validate2 (https://localhost:8181/yaml.worker.a42e65.js:35547:3)
    at _validateObjectNode (https://localhost:8181/yaml.worker.a42e65.js:36087:13)
    at validate2 (https://localhost:8181/yaml.worker.a42e65.js:35533:7)
    at SingleYAMLDocument.validate (https://localhost:8181/yaml.worker.a42e65.js:35478:7)
    at getDiagnostics (https://localhost:8181/yaml.worker.a42e65.js:34011:47)
    at https://localhost:8181/yaml.worker.a42e65.js:34048:16

YAML:

template:
  name: yaml validation error template
  identifier: yaml_validation_error_template
  versionLabel: "1"
  type: Step
  projectIdentifier: test
  orgIdentifier: default
  tags: {}
  spec:
    type: Wait
    spec:
      duration: 10m

Schema: https://raw.githubusercontent.com/harness/harness-schema/dc42a2b54209b66a635734d4fa8b891a7903a63f/v0/template.json

Expected Behavior

Features like code completion, validation, etc., work as expected

Current Behavior

Seeing errors related to validation in the console

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the error with the YAML and schema URL from the report, then trace the validation entry points shown in the stack trace, including _validateObjectNode, validate2, and SingleYAMLDocument.validate. Identify why validation attempts to assign url on a string and verify that diagnostics, validation, and schema-based suggestions work without console errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, yaml
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.