Conversation
Entries set by the COMPOSE_FILE environment variable used to be resolved
to absolute paths with a bare os.Stat check, so an empty or directory
entry made the loader fail later with a cryptic OS-level error such as
"read <pwd>: is a directory" (an empty entry resolves to the working
directory).
Validate each entry when it is selected: it must be stdin ("-"), a
remote resource supported by a registered ResourceLoader, or a regular
local file. Errors now state how the file was selected:
compose file "" set by COMPOSE_FILE environment variable is invalid: /home/user is a directory
Config paths selected implicitly (COMPOSE_FILE, default file discovery)
are also tracked so read errors are decorated the same way, while
explicitly selected files (-f) keep a plain "compose file X is invalid"
prefix.
See docker/compose#13649
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
The Compose Specification makes the runtime responsible for warning about attributes it parses but ignores (docker/compose#13150). Instead of each runtime hand-enumerating what it does NOT implement, the loader can screen the merged model against a declaration of what it DOES: - Options.SupportedAttributes takes a set of tree.Path patterns; every attribute of the canonical, pre-normalization model (what the user actually wrote) matching none of them is reported through Options.UnsupportedAttribute (default: a logrus warning). Extension keys (x-*) are never reported; an undeclared subtree is reported once at its root. - tree.Matcher gives Path pattern sets a first-class matching API: exact Matches — declaring a path accepts that node only, so removing one leaf from a declared set reliably surfaces it — plus MayContain for walkers that must know when a declared attribute lives deeper. - schema.AttributePaths derives the complete attribute-path inventory from the embedded JSON schema (pattern-keyed mappings as '*', sequence items as '[]', $ref cycles terminated, '^x-' pattern properties excluded: recording them as wildcards would blanket-accept every undeclared sibling). A runtime builds its declaration by removing what it does not implement from the full specification, so every newly-specified attribute stays reported until deliberately wired in. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Collaborator
Author
|
will be combined with #927 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Compose Specification makes the runtime responsible for warning about attributes it parses but ignores (docker/compose#13150). Instead of each runtime hand-enumerating what it does not implement, the loader can screen the merged model against a declaration of what it does:
Options.SupportedAttributestakes a set oftree.Pathpatterns; every attribute of the canonical, pre-normalization model (what the user actually wrote) matching none of them is reported throughOptions.UnsupportedAttribute(default: a logrus warning). Extension keys (x-*) are never reported; an undeclared subtree is reported once at its root.tree.Matchergivestree.Pathpattern sets a first-class matching API: exactMatches— declaring a path accepts that node only, so removing one leaf from a declared set reliably surfaces it — plusMayContainfor walkers that must know when a declared attribute lives deeper.schema.AttributePathsderives the complete attribute-path inventory from the embedded JSON schema (pattern-keyed mappings as*, sequence items as[],$refcycles terminated,^x-pattern properties excluded — recorded as wildcards they would blanket-accept every undeclared sibling). A runtime builds its declaration by removing what it does not implement from the full specification, so every newly-specified attribute stays reported until deliberately wired in.Example — a runtime declaring
schema.AttributePaths()minus the swarm-only subtrees, loading the docker/compose#13149 file:🤖 Generated with Claude Code