KohlbacherLab / dnpm-dip-api-gateway

REST API Gateway component for DNPM:DIP
MIT License
0 stars 0 forks source link

SchemaError: Failed validating 'pattern' #3

Closed kilpert closed 1 month ago

kilpert commented 2 months ago

When testing the downloaded schema json (https://dnpm.bwhealthcloud.de/api/rd/etl/patient-record/schema) there is a SchemaError on some validators, e.g. in python using jsonschema.validate():

jsonschema.exceptions.SchemaError: 'Coding[GMFCS]' does not match '^[A-Za-z_][-A-Za-z0-9._]*$'

Failed validating 'pattern' in metaschema['allOf'][0]['properties']['$defs']['additionalProperties']['$dynamicRef']['allOf'][0]['properties']['$anchor']:
    {'type': 'string', 'pattern': '^[A-Za-z_][-A-Za-z0-9._]*$'}

On schema['$defs']['Coding[GMFCS]']['$anchor']:
    'Coding[GMFCS]'

The problem is the squared brackets in e.g. 'Coding[GMFCS]'. When replacing them with an allowed character, e.g. "_", validation is fine, i.e. 'Coding_GMFCS'.

Tested with:

jsonschema 4.23.0
jsonschema-specifications 2023.12.1
python 3.12.4 
lucienclin commented 1 month ago

Thanks for the issue report. This is now fixed.