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

fix: array default value #968

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

p-spacek
Copy link
Contributor

What does this PR do?

fix the issue when a default value is an array with object items

this schema

        {
          type: 'object',
          properties: {
            garage: {
              type: 'array',
              items: {
                type: 'object',
              },
              default: [
                {
                  car: {
                    engine: { fuel: 'gasoline' },
                    wheel: [1, 2],
                  },
                },
                {
                  car: {
                    engine: { fuel: 'diesel' },
                  },
                },
              ],
            },
          },

produced invalid yaml before:

garage:
 - [Object object]

after fix:

garage:
  - car:
      engine: 
         fuel: gasoline
      wheel:
         - 1
         - 2
  - car:
       engine:
          fuel: diesel

after the fix, it will correctly process the default value with the object array

Is it tested? How?

added tests

p-spacek added a commit to jigx-com/rh-yaml-language-server that referenced this pull request May 20, 2024
@p-spacek p-spacek force-pushed the fix/array-default-value branch from 5428060 to ce643a9 Compare May 29, 2024 12:29
@coveralls
Copy link

Coverage Status

coverage: 84.201% (+0.03%) from 84.174%
when pulling ce643a9 on jigx-com:fix/array-default-value
into 7203630 on redhat-developer:main.

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

Successfully merging this pull request may close these issues.

2 participants