Desription

GenRocket lets you import your data model in several ways using JSON. With the Import from JSON Schema option, you can use a standard JSON schema to set up your data model within the selected Project Version.

Alternative JSON import options include:
  • JSON File - Import a JSON file with a flat or nested format.
  • GenRocket DDL JSON SchemaGenRocket has defined a JSON Data Definition Language (DDL) standard that supports multiple JSON structures, enabling users to map their data to GenRocket's DDL Schema.


In This Article


Sample Nested Schema (4 Domains)

The nested JSON schema file below is attached to this article. You can download it or copy and paste it into your own file. It includes four objects that will be imported as Domains: Organization, Department, Customer, and Address.

{
  "$id": "https://example.com/org-dept-customer.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "organization",
  "type": "object",
  "properties": {
    "orgName": {"type": "string"},
    "orgPhone": {"type": "string"},
     "department": {
          "type": "object",
          "properties": {
            "deptName": {"type": "string"},
            "deptPhone": {"type": "string"},
            "customer": {
            "type": "object",
            "properties": {
                "firstName": {"type": "string"},
                "lastName": {"type": "string"},
                "address": {
                "type": "object",
                "properties": {
                    "street": { "type": "string" },
                    "city": { "type": "string" },
                    "state": { "type": "string" },
                    "postalCode": { "type": "string" },
                    "country": { "type": "string" }
                },
              "required": ["street", "city", "state", "postalCode", "country"]
            }
          },
          "required": ["firstName", "lastName", "address"]
        }
      },
      "required": ["deptName", "customer"]
    }
  },
  "required": ["orgName", "department"]
}


Steps to Import Your Schema

Complete the following steps to import your data model using a JSON schema: 

  • Expand the New Domain menu and select "Import from JSON Schema" to begin.



  • Browse to the location of your JSON schema and select it for import.


    Note: You will see an error message if the schema is not formatted correctly.

  • Select an Output Format Type (JSON, Avro, Parquet, or ORC). 
  • The default selection is JSON, which means one or more nested JSON files will be generated. 
  • You can select a different output type from the drop-down menu. 
  • Click Save and wait patiently for the schema import to finish.


Import Results - Project Setup

Your project is set up based on the schema you selected. In this example, these setup tasks are handled automatically:
  • Domain Creation - Organization, Department, Customer, Address, and Merge Domains. Each has the defined Attributes and default assigned Generators. 

  • Scenario Creation - One Scenario for each Domain, including the Merge Domain.

  • Scenario Chain Creation - Contains all Domain Scenarios in proper test data generation order, with the merge domain last to merge all generated segments.


  • Relationships (Referential Integrity) - Organization -> Department -> Customer -> Address


  • Receiver Assignment - The SegmentDataCreatorReceiver is assigned to each Domain (except the Merge Domain). A JSONSegmentMergeDomain is assigned to the Merge Domain since JSON was selected as the Output Format Type. If a different output type were selected (e.g., Parquet, Avro, ORC), then a different Merge Receiver would be assigned. 



  • Configuration File Creation - Each Domain's data is generated as a separate segment. The configuration file is needed to merge data from different Domains into one or more files. Click here to learn more.


Next Steps

Now it's time to customize your Project Version by adjusting aspects such as the type of data generated, output format, and defining volume/variety needs.
  1. Generator Tuning (Optional) - You can assign a different Generator, change its parameters, or link Generators for more complex data needs. Helpful links:
  2. Change Segment Receiver (Optional) - If you need a different nested output format than what was initially chosen, you can do so by assigning a different Merge Receiver (e.g., Delimited, XML, SOAP) to the Merge Domain. 

    Note: If you change the assigned Merge Receiver, you will also need to create a new configuration file. These are specific to the output format type. Individual instructions are provided as part of each Merge Receiver article. 

  3. Test Data Cases (Recommended) - Set up one or more Test Data Cases (G-Cases) to generate the required data volume and variety for the Project Version. Click here to learn more.

  4. Test Data Rules (Optional) - Set up one or more Test Data Rules (G-Rules) to generate conditioned test data that adheres to specified business logic. Click here to learn more.

  5. Test Data Queries (Optional) - Set up one or more Test Data Queries (G-Queries) to query data from a database or CSV/Excel file for selected Domain Attributes. Click here to learn more.