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 x-* extension on 3rd level objects #1097

Merged
merged 1 commit into from Jun 1, 2018
Merged

Conversation

@vdemeester
Copy link
Collaborator

@vdemeester vdemeester commented May 31, 2018

As for top-level key, any 3rd-level key which starts with x- will be
ignored by compose. This allows for users to:

  • include additional metadata in their compose files
  • create YAML anchor objects that can be re-used in other parts of the config

This matches a similar feature in the swagger spec definition:
https://swagger.io/specification/#specificationExtensions

This means a composefile like the following is valid

verison: "3.7"
services:
  foo:
    image: foo/bar
    x-foo: bar
network:
  bar:
    x-bar: baz
x-top:
  foo: bar

It concerns services, volumes, networks, configs and secrets.

Signed-off-by: Vincent Demeester vincent@sbr.pm

As for top-level key, any 3rd-level key which starts with `x-` will be
ignored by compose. This allows for users to:
* include additional metadata in their compose files
* create YAML anchor objects that can be re-used in other parts of the config

This matches a similar feature in the swagger spec definition:
https://swagger.io/specification/#specificationExtensions

This means a composefile like the following is valid

```
verison: "3.7"
services:
  foo:
    image: foo/bar
    x-foo: bar
network:
  bar:
    x-bar: baz
```

It concerns services, volumes, networks, configs and secrets.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Copy link
Member

@thaJeztah thaJeztah left a comment

SGTM 👍

@silvin-lubecki
Copy link
Contributor

@silvin-lubecki silvin-lubecki commented May 31, 2018

Does docker-compose need this feature too?

@vdemeester
Copy link
Collaborator Author

@vdemeester vdemeester commented May 31, 2018

@silvin-lubecki yes, there is already a PR in docker/compose for it docker/compose#5995

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

LGTM

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jun 1, 2018

Okay, let's merge!

@thaJeztah thaJeztah merged commit eb54d3e into docker:master Jun 1, 2018
7 checks passed
7 checks passed
ci/circleci: cross Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: shellcheck Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: validate Your tests passed on CircleCI!
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
dco-signed All commits are signed
@GordonTheTurtle GordonTheTurtle added this to the 18.06.0 milestone Jun 1, 2018
@vdemeester vdemeester deleted the vdemeester:x-objects branch Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants