The idea is for the JSON files to include array of {schema} (e.g. Tag, Organization) or {schema}CreateRequest objects (e.g. Grant, Challenge). This approach will simplify the validation of the JSON data and seeding the database.
For example, the challenge objects listed in challenges.json have their property organizerIds set to an array of PersonCreateRequest objects. However, this approach clashes with the ROCC schemas that says that organizerIds should be set to an array of string (Person ID). Here the proposed solution is to update the process that generates the JSON files to do the following:
Create a file persons.json that includes the list of Person object to create. For each Person object, set Person.id to a randomly generated id that follow the expected schemas of Person.id.
Update the Challenge objects so that Challenge.organizerIds include the correct Person IDs.
Extending this approach to all the properties of all the schemas when needed, the resulting JSON files will be compliant with the ROCC schemas.
The script that seeds the data base will then be responsible to replacing "temporary IDs" by "real ID" once the objects have been created. Temporary IDs must only be generated for objects that have their IDs generated by the API service (Grants, Challenges, Persons, etc.).
The idea is for the JSON files to include array of
{schema}
(e.g. Tag, Organization) or{schema}CreateRequest
objects (e.g. Grant, Challenge). This approach will simplify the validation of the JSON data and seeding the database.For example, the challenge objects listed in
challenges.json
have their propertyorganizerIds
set to an array ofPersonCreateRequest
objects. However, this approach clashes with the ROCC schemas that says thatorganizerIds
should be set to an array of string (Person ID). Here the proposed solution is to update the process that generates the JSON files to do the following:persons.json
that includes the list of Person object to create. For each Person object, setPerson.id
to a randomly generated id that follow the expected schemas ofPerson.id
.Challenge.organizerIds
include the correct Person IDs.Extending this approach to all the properties of all the schemas when needed, the resulting JSON files will be compliant with the ROCC schemas.
The script that seeds the data base will then be responsible to replacing "temporary IDs" by "real ID" once the objects have been created. Temporary IDs must only be generated for objects that have their IDs generated by the API service (Grants, Challenges, Persons, etc.).