-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
docker-compose file doesn't handle YAML in flow mode (where tabs are valid) #5662
Comments
I believe you are misreading the spec - The only occurrence of the "neither content nor indentation" phrase you mention was related to whitespace appearing before comment lines. That same section also includes the following mention:
In the section on tabs, the following mention can be found:
The section describing flow styles doesn't make any mention of tabs being allowed, so this particular rule doesn't seem to be overridden like you suggest. |
None of that contradict the line quoted, "indentation" which is the determination of block scoping via whitespace does not apply to flow styling. So "indentation" correctly can't contain tabs, but when using flow styling, it is sigils and not "indentation" that determines scope. whitespace (including tabs) prior to keys and other content is not considered indentation. http://www.yaml.org/spec/current.html#id2530054
|
^^^^^^^^^^^^^^^ |
Separation spaces are between tokens not prior. The fact is that well behaving YAML parsers correctly handle tabs preceding flow statement lines. |
The case presented by @Curtis-Fletcher seems to be a special case where flow style is used in the entirety of the document, so technically there is no indentation going on, just presentation detail. The spec actually shows a similar example of a flow-style used within a block-style parent element here. ··# Leading comment line spaces are
···# neither content nor indentation.
····
Not indented:
·By one space: |
····By four
······spaces
·Flow style: [ # Leading spaces
···By two, # in flow style
··Also by two, # are neither
··→Still by two # content nor
····] # indentation. You can see it the second-to-last line that tabs are also ignored in flow context, which would make the example valid. EDIT: {
"adjacent":value,
"readable":·value,
"empty":°
} |
Here is an example of flow style being validated with tabs as non-indent presentation by the YAML reference parser: http://ben-kiki.org/ypaste/data/272/index.html both tabs and space are evaluated as "non content whitespace" Also note that LibYAML as exposed in (for example Perl) has no issue:
|
Thanks for the links ; looks like I overlooked some of the details. Unfortunately, neither |
Perfectly reasonable, if I happen to find a simple solution for python I assume I can post it here? |
Sure, I'd be happy to look at it ; Moving off |
Seems like using the libYAML bindings in PyYAML rather than the pure python implimentation parses correctly:
You can even wrap it so that systems without libYAML work:
|
Hmm, that requires libyaml to be installed, and |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
According to the YAML spec, when in flow style, leading whitespace (tabs or spaces) is "neither content nor indentation." whereas in a docker compose file specified as *.json or *.yml a trivial case of valid flow style cosmetically indented with tabs
results in a YAML parse error:
Which is incorrect for tokens in flow mode.
This is for docker-compose version 1.18.0, build 8dd22a9 on MacOS
The text was updated successfully, but these errors were encountered: