Open mrshll1001 opened 10 months ago
1)
I'm not entirely sure if it should, but _schemas_to_datapackage
expects a constraints
attribute in the schema file.
Something like this should work:
"test": {
"name": "test",
"type": "string",
"title": "Test",
"description": "A test.",
"example": "test",
"constraints": {
"unique": false
}
}
2)
A foreign key can be detected from either direction. In this case it's still being picked up from organization.json
. Adding "funding": null
to profile/organization.json
should get you the behaviour you want.
Thanks.
In light of this, is my current understanding correct?
constraints
key, and Profiles should take care to null out foreign keys from both directionsYes. Although I'm not sure about constraints
In the Profiles mechanism, the schema tools will take all the changes defined in a
profile
directory and create full profile schemas via a JSON merge patch, into theschema
directory. It will also then generate a datapackage.json file based on these schemas.This is not behaving as expected, since some changes made to the schema via the Profile are not reflected in the datapackage.json. This has a knock-on effect for the ERD diagrams for profiles.
This problem also persists when generating a datapackage manually e.g via
hsds_schema.py schemas-to-datapackage schemas/ > test.json
, so the root cause may be there.E.g. adding
test
tofunding.json
, and runningprofile-all --clean
with the repo URI will not addtest
as a field inside thefunding
entry indatapackage.json
. This prevents it from being rendered in the ERD.test
is present in theschema/funding.json
file, so should be reflected in the datapackage.Conversely, removed fields are actually removed from the datapackage. The UK profile removes
organization_id
fromfunding.json
. After runningprofile-all --clean
and openingdatapackage.json
, it's clear thatorganization_id
is not present inside ofresources['funding']/fields
. However, it is still referenced inside ofresources['funding']/foreignKeys
. This causes errors when generating an ERD from the datapackage.