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

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 [email protected]

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 <[email protected]>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM 👍

@silvin-lubecki
Copy link
Contributor

Does docker-compose need this feature too?

@vdemeester
Copy link
Collaborator Author

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Member

Okay, let's merge!

@thaJeztah thaJeztah merged commit eb54d3e into docker:master Jun 1, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.06.0 milestone Jun 1, 2018
@vdemeester vdemeester deleted the x-objects branch June 1, 2018 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants