compose-spec / compose-spec

The Compose specification

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:
grafik

while to one used by the JSON schema looks like this:
grafik

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