Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checks - Links array has one and only one describedby value, value is correct #13

Closed
odscjames opened this issue Oct 25, 2022 · 3 comments

Comments

@odscjames
Copy link
Collaborator

https://json-schema.org/understanding-json-schema/reference/array.html#contains will only do some of these checks

@duncandewhurst
Copy link
Contributor

I think that we can handle this in the schema without needing an additional check by using tuple validation and items, e.g.

{
    "links": {
      "type": "array",
      "prefixItems": [
        {
          "type": "object",
          "properties": {
            "href": {
              "type": "string",
              "const": "https://raw.githubusercontent.com/Open-Telecoms-Data/open-fibre-data-standard/0__1__0__beta/schema/network-schema.json"
            },
            "rel": {
              "type": "string",
              "const": "describedby"
            }
          }
        }
      ],
      "items": {
        "$ref": "#/definitions/Link"
      },
      "minItems": 1,
      "uniqueItems": true
    }
}

The only downside that I can see is that would mean that the describedby link would always need to be the first item in the links array. I don't think that's too much of an extra problem for implementers.

Does that sound good? If so I'll update Open-Telecoms-Data/open-fibre-data-standard#157

@odscjames
Copy link
Collaborator Author

Think that is good

@duncandewhurst
Copy link
Contributor

Closing as this is now handled by schema validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants