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

URL fragment references does not resolve correctly

Open
#949 1 comment 1 reaction 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

The URL fragments in schema URL feature does not work as expected. Take, for example, following YAML file referencing and Open API schema fragment.

# yaml-language-server: $schema=https://github.com/OAI/OpenAPI-Specification/raw/main/schemas/v3.1/schema.json#/$defs/parameter
name: token
in: header
description: token to be passed as a header
required: true
schema:
  type: array
  items:
    type: integer
    format: int64
style: simple

Here is a reference to the parameter object.

Instead of validation the object using the fragment, it validates it using the base object in the schema.

Expected Behavior

I would expect yamlls to resolve the fragment and use the objects' definition as its base for validation.

Steps to Reproduce

  1. Create a yaml file
  2. Paste the yaml above
  3. Watch yamlls output

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

Start by reproducing the issue with the YAML example and trace the schema URL resolution path, since no source file or test is named in the report. Done means the #/$defs/parameter fragment is resolved and the YAML object is validated against that definition rather than the base schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.