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

Conversation

@vdemeester
Member

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

Allow `x-*` extension on 3rd level objects
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>
@thaJeztah

SGTM 👍

@silvin-lubecki

This comment has been minimized.

Contributor

silvin-lubecki commented May 31, 2018

Does docker-compose need this feature too?

@vdemeester

This comment has been minimized.

Member

vdemeester commented May 31, 2018

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

@silvin-lubecki

LGTM

@thaJeztah

This comment has been minimized.

Member

thaJeztah commented Jun 1, 2018

Okay, let's merge!

@thaJeztah thaJeztah merged commit eb54d3e into docker:master Jun 1, 2018

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