Skip to content

Allow x-* extension on 3rd level objects#1097

Merged
thaJeztah merged 1 commit intodocker:masterfrom
vdemeester:x-objects
Jun 1, 2018
Merged

Allow x-* extension on 3rd level objects#1097
thaJeztah merged 1 commit intodocker:masterfrom
vdemeester:x-objects

Conversation

@vdemeester
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Does docker-compose need this feature too?

@vdemeester
Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
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
Copy Markdown
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