Skip to content

cli/compose/types: ServiceVolumeConfig: use strong type for Type and Consistency fields - #4200

Open
thaJeztah wants to merge 2 commits into
docker:masterfrom
thaJeztah:compose_stronger_typed
Open

thaJeztah wants to merge 2 commits into
docker:masterfrom
thaJeztah:compose_stronger_typed

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

cli/compose/types: ServiceVolumeConfig: use strong type for Type field

Using a strong type for this field, to make it clearer what's supported,
and to allow assigning values without having to convert them to a string.

Also renamed a variable that collided with an import.

cli/compose/types: ServiceVolumeConfig: use strong type for Consistency field

Using a strong type for this field, to make it clearer what's supported,
and to allow assigning values without having to cast them.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review area/stack kind/refactor PR's that refactor, or clean-up code labels Apr 12, 2023
@thaJeztah thaJeztah changed the title compose_stronger_typedcli/compose/types: ServiceVolumeConfig: use strong type for Type and Consistency fields cli/compose/types: ServiceVolumeConfig: use strong type for Type and Consistency fields Apr 12, 2023
@thaJeztah
thaJeztah marked this pull request as ready for review April 12, 2023 20:59
@thaJeztah
thaJeztah force-pushed the compose_stronger_typed branch from 8f6ff0f to eede5eb Compare July 25, 2023 04:59
@codecov-commenter

codecov-commenter commented Jul 25, 2023 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/compose/convert/volume.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah
thaJeztah force-pushed the compose_stronger_typed branch from eede5eb to 1f7311c Compare July 25, 2023 05:41
Comment thread cli/compose/types/types.go Outdated
Comment on lines +7 to +8

"github.com/docker/docker/api/types/mount"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the reason these types were not imported was to make the compose-types not directly depend on docker API types, and to keep it "agnostic".

Now that the compose-spec exists, I don't think that should still be a concern, as the compose implementation in this repository is only for docker stack; users that want a more agnostic implementation are better off using the compose-spec as a library than the types from this repo.

@thaJeztah
thaJeztah force-pushed the compose_stronger_typed branch from 1f7311c to 7d7b4a1 Compare July 25, 2023 06:49
Using a strong type for this field, to make it clearer what's supported,
and to allow assigning values without having to convert them to a string.

Also renamed a variable that collided with an import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

WIP: change type

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…cy field

Using a strong type for this field, to make it clearer what's supported,
and to allow assigning values without having to cast them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah force-pushed the compose_stronger_typed branch from 7d7b4a1 to ebdd5fe Compare September 3, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/stack kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants