Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Schema update for relational data #1709

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tjohnson-scottlogic
Copy link
Contributor

Description

Extend the scope of the JSON schema to include validation of the relationships section of the profile (which is described here).

Changes

Additional notes

Couldn't work out how to do validation of extents.

Issue

Resolves #1708

Copy link
Contributor

@Tom-hayden Tom-hayden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Contributor

@sl-slaing sl-slaing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main issue here is the 'profile' property in the schema should refer back to the main schema. Otherwise there are 2+ profile schemas to maintain.

docs/UserGuide.md Outdated Show resolved Hide resolved
},
"profile": {
"type": "object",
"additionalProperties": false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you 'ref' back to the main schema here? This object should confirm to the profile schema, and can contain relationships itself which isn't represented here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, hadn't realised a relationship could contain another relationship. I can't work out how to refer back to the main schema, but I have added a relationships section at the bottom, which seems to work. Not ideal to have fields, constraints and relationships defined twice though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do something like this?

...
"profile": {
   "$ref": "#/"
}
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. From how I understand it you have to have some initial entries in the schema first, then they can refer to definitions below. I don't think you can effectively go straight to the definitions. I tried the above anyhow but it didn't work for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed @sl-slaing, our aim is to not change the profile format itself and to fix this in the schema. We also don't want to have fields, constraints and relationships defined in two places. The Recursion section of the JSON Schema Reference should help, just can't figure it out at the moment.

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

Successfully merging this pull request may close these issues.

Relational data beta feature isn't valid in the Profile Validation schema
3 participants