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

Allow yaml-anchors in schema #2200

Merged
merged 4 commits into from
Jan 23, 2025
Merged

Conversation

ilyakuz-db
Copy link
Contributor

@ilyakuz-db ilyakuz-db commented Jan 21, 2025

Changes

Allows custom untyped fields in the root config in json-schema so it doesn't highlight errors when using yaml-anchors.

Example use case:

tags: &job-tags
  environment: ${bundle.target}


resources:
  jobs:
    db1:
      tags:
        <<: *job-tags
    db1:
      tags:
        <<: *job-tags

One downside is that we don't highlight any unknown top-level properties anymore (but they will still fail during CLI validation)

Tests

Manually checked behavior in VSCode - it doesn't show validation error. Also checked that other typed properties are still suggested

@denik denik requested review from denik and removed request for denik January 21, 2025 14:11
@ilyakuz-db ilyakuz-db changed the title fix: Allow yaml-anchors in schema fix(json-schema): Allow yaml-anchors in schema Jan 21, 2025
@ilyakuz-db ilyakuz-db changed the title fix(json-schema): Allow yaml-anchors in schema Allow yaml-anchors in schema Jan 21, 2025
@ilyakuz-db
Copy link
Contributor Author

@shreyas-goenka could you take a look?

// AdditionalProperties is set to an empty schema to allow non-typed keys used as yaml-anchors
// Example:
// some_anchor: &some_anchor
// file_path: /some/path/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab in comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with spaces

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make a corresponding passing test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, added!

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ilyakuz-db ilyakuz-db added this pull request to the merge queue Jan 23, 2025
Merged via the queue into main with commit f60ad32 Jan 23, 2025
9 checks passed
@ilyakuz-db ilyakuz-db deleted the feat/json-schema-allow-yaml-anchors branch January 23, 2025 11:18
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