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

Array with default value of empty array

Open
#409 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

Example schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://example.com",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "empty_array": {
          "type": "array",
          "default": [],
          "items": {
            "type": "object"
          }
        }
      }
    }
  ]
}

When the empty_array property is auto-inserted is there a way for the value to be an empty array?

Current behaviour on auto-insertion

empty_array:
  -

Desired behaviour

empty_array: []

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 reported auto-insertion using the example JSON Schema in the YAML language server and compare the generated YAML with the desired empty-array form. Trace the default-value insertion path and add coverage showing that an array default of [] is emitted as empty_array: []; the issue is complete when this behavior is verified without regressing other defaults.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.