0

I am trying to structure the json-schema after a json response I want to send.

I have tried several versions of object->array->object->array, but it does not seem like I can validate an UUID key with a regex using patternProperties

The JSON looks like this:

 [{
    "54ffe69-b8f6-47c8-9437-ccea8ecc2d77": {
        "name": "ORC",
        "$description": "Design polar from ORC",
        "source": {
            "label": "signalk-polar"
        },
        "polarData": [{
            "trueWindSpeed": 3.086666667,
            "beatAngles": [
                0.738274274
            ]
        }]
    }
 }]
Joachim
  • 13
  • 3

1 Answers1

0

Not really sure, it might be something wrong with the UUID that you are trying to validate. It is though accepting this pattern:

[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

but, according to this post, we should have had:

[0-9a-f]{8}

in the starting part, or I might be wrong.

Demo

Community
  • 1
  • 1
Emma
  • 1
  • 9
  • 28
  • 53
  • You are right. I had been trying to test if the tests would fail when changing the uuid, so I had removed the first `a`. The uuid is really `a56bc52a-877e-41f1-a977-f81f8d50c68f`. This is for https://github.com/SignalK/specification/pull/360 and the issue I had was that the tests passed when I had the root type to `array`, even when the rest was clearly wrong. – Joachim Jul 03 '19 at 13:01