1

I have a configuration application in Nodejs. It has a Component with name and uuid. A Component can have many Schemas. A Schema has a uuid, name, componentId, json. A Schema can have many Configurations. A Configuration has name, schemaId, json and uuid. A Schema can contain reference of many other Schemas in it. Now I want to create a functionality of exporting all the data from one instance of the application ( in json format in file ) and import it in another. What should be the simplest way to do it? a few questions are

  1. How to tell application what to export. for now i think there should be separate arrays for components, schemas and configurations. Like
{
    components: ['id1', 'id2'],
    schemas: ['s1', 's2'],
    configuration: ['c1', 'c2'],
}

this data should be sent to application to return a file with all information that will later be used for importing in another instance

  1. The real question is how should my export file look like keeping in mind that dependencies are also involved and dependencies can also overlap. for example a schema can have many other schemas referenced in its json field. eg schema1 has schema2 and schema4 as its dependencies. so there is another schema schema5 that also require schema2. so while importing we have to make sure that schema2 should be saved first before saving schema1 and schema5. how to represent such file that requires order as well as overlapped dependencies, making sure that schema2 is not saved twice while importing. json of schema1 is shown below as an example
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "p1": {
        "$ref": "link-to-schema2"
    },
    "p2": {
        "$ref": "link-to-schema4"
    },

}

  1. What should be the step wise sudo algorithm i should follow while importing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.