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

YAML Anchor / Fragments Support #39

Closed
adaliszk opened this issue Oct 22, 2024 · 3 comments · Fixed by #41
Closed

YAML Anchor / Fragments Support #39

adaliszk opened this issue Oct 22, 2024 · 3 comments · Fixed by #41
Assignees
Labels
bug Something isn't working released

Comments

@adaliszk
Copy link

Version

v1.0.6

YAML file where the error occurs

name: fragment-example

x-shared-links: &shared-links
  links:
    - "foo:foo.example.svc.cluster.local"
    - "bar:bar.example.svc.cluster.local"

services:
  foo:
    image: traefik/whoami:v1.10

  bar:
    image: traefik/whoami:v1.10
    
  app_foo:
    image: traefik/whoami:v1.10
    <<: *shared-links

  app_bar:
    image: traefik/whoami:v1.10
    <<: *shared-links

Command used to run

npx dclint .

Additional context

Current behavior (console output)

ComposeValidationError: instancePath="/services/foo", schemaPath="#/additionalProperties", message="Validation error: must NOT have additional properties".  invalid-schema

Expected behavior

The Anchors / Fragments should be resolved before validating the schema, and thus the error would not tell that additional properties are not allowed, as there are no actual keys like << being used after parsing the YAML.

@adaliszk adaliszk added the bug Something isn't working label Oct 22, 2024
@zavoloklom zavoloklom self-assigned this Oct 26, 2024
zavoloklom added a commit that referenced this issue Oct 26, 2024
zavoloklom added a commit that referenced this issue Oct 26, 2024
zavoloklom added a commit that referenced this issue Oct 26, 2024
zavoloklom added a commit that referenced this issue Oct 26, 2024
@zavoloklom
Copy link
Owner

🎉 This issue has been resolved in version 1.0.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@zavoloklom
Copy link
Owner

@adaliszk Hi! I fixed it in v1.0.7, but there are some limitations - https://github.com/zavoloklom/docker-compose-linter?tab=readme-ov-file#anchor-handling

Please let me know if something goes wrong.

@adaliszk
Copy link
Author

Thank you very much!
It looks promising; I will try to make time next week to add the tool as a listing step in my current project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants