JSON schema string format "duration" != compose "duration"
sharknoon opened this issue · comments
Hello,
the compose-spec.json
isn't in sync with the actual compose spec. The type of duration is different from the one used by Docker.
Docker Compose duration
definition: https://docs.docker.com/compose/compose-file/11-extension/#specifying-durations
JSON schema duration
definition: https://datatracker.ietf.org/doc/html/rfc3339#appendix-A (scroll down a bit)
Minimal reproduction example:
version: "3.7"
services:
hello:
image: hello-world
stop_grace_period: 1m
The problem is that the Docker definition of duration
looks like this:
while to one used by the JSON schema looks like this:
So that would be stop_grace_period: P1M
instead of stop_grace_period: 1m
to be compliant with the JSON schema.
Solution
Replace the format: "duration"
in the compose spec with a regex spec something like this (\d+(us|ms|s|m|h))+
Thank you
Kind regards
Sharknoon