Interpolation does not supported in recent `compose-spec.json` file
Taragolis opened this issue · comments
What is the problem you're trying to solve
Hey everyone! We use in Apache Airflow compose-spec (https://github.com/compose-spec/compose-spec/blob/master/schema/compose-spec.json) for validate Compose files, however after the recent changes we can't use Interpolation in some fields
E.g. validate https://github.com/apache/airflow/blob/b9dc8e67bc15a09aca9aaff4236d221644078a6c/scripts/ci/docker-compose/backend-mysql.yml against JSON Schema will raise an error
Processing file: scripts/ci/docker-compose/backend-mysql-port.yml
'${MYSQL_HOST_PORT}:3306' is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['services']['patternProperties']['^[a-zA-Z0-9._-]+$']['properties']['ports']['items']:
{'oneOf': [{'type': 'number'},
{'pattern': '^((\\d+((\\.\\d+)+|(-\\d+))*):?){1,3}(/(tcp|udp))?$',
'type': 'string'},
{'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'app_protocol': {'description': 'The '
'application '
'protocol '
'(TCP/IP '
'level 4 / '
'OSI level '
'7) this '
'port is '
'used for. '
'This is '
'optional '
'and can be '
'used as a '
'hint for '
'Compose to '
'offer '
'richer '
'behavior '
'for '
'protocols '
'that it '
'understands',
'type': 'string'},
'host_ip': {'description': 'The Host IP '
'mapping, '
'unspecified '
'means all '
'network '
'interfaces '
'(0.0.0.0)',
'format': 'ipv4',
'type': 'string'},
'mode': {'description': 'host: For '
'publishing a host '
'port on each node, '
'or ingress: for a '
'port to be load '
'balanced. Defaults '
'to ingress.',
'pattern': '^ingress|host$',
'type': 'string'},
'name': {'description': 'A human-readable '
'name for the port, '
'used to document '
"it's usage within "
'the service',
'type': 'string'},
'protocol': {'description': 'The port '
'protocol (tcp '
'or udp). '
'Defaults to '
'tcp',
'pattern': '^tcp|udp$',
'type': 'string'},
'published': {'anyOf': [{'$ref': '#/definitions/port_format'},
{'$ref': '#/definitions/port_published_format'}],
'description': 'The publicly '
'exposed port. '
'It is defined '
'as a string '
'and can be '
'set as a '
'range using '
'syntax '
'start-end. It '
'means the '
'actual port '
'is assigned a '
'remaining '
'available '
'port, within '
'the set '
'range.'},
'target': {'$ref': '#/definitions/port_format',
'description': 'The container '
'port'}},
'type': 'object'}]}
On instance['services']['mysql']['ports'][0]:
'${MYSQL_HOST_PORT}:3306
Describe the solution you'd like
Is it possible to somehow take in account interpolations in regex?
@Taragolis sorry for this, we reverted our changes as we forgot to manage variables