Importing a data model definition file

You can automatically populate a data model with composite types and enumeration types that are imported from a JSON schema file.

About this task

The following JSON schema formats are supported:
  • Swagger 2.0
  • OpenAPI 2.0
  • OpenAPI 3.0
  • OpenAPI 3.1
  • JSON schema draft 04
  • JSON schema draft 06
  • JSON schema draft 07
  • JSON schema draft 2019-09
  • JSON schema draft 2020-12
The following example shows a Swagger 2.0 definition file that contains a definitions element. Inside the definitions element, two data types are described:
  • A composite type person with multiple attributes.
  • An enumeration type status with three values: Married, Single, and Divorced.
{
  "swagger": "2.0",
  "info": {
    "title": "Swagger definition file",
    "description": "Simple definition file"
  },
  "definitions": {
    "Person": {
      "type": "object",
      "properties": {
        "firstName": {
          "type": "string"
        },
        "dateOfBirth": {
          "type": "string",
          "format": "date-time"
        },
        "dateOfLoanStart": {
          "type": "string",
          "format": "date"
        },
        "numberOfChildren": {
          "type": "integer"
        },
        "income": {
          "type": "number"
        },
        "noBankrupcy": {
          "type": "boolean"
        },
        "lastName": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "Married",
            "Single",
            "Divorced"
          ]
        },
        "descendants": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Person"
          }
        }
      }
    }
  }
}

Procedure

  1. Open the Data tab in your decision service and click Create.
  2. Enter a name for the data model.
  3. Drag your definition file into the drop target area.
    Alternatively, you can click the drop target area and navigate to the definition file on your local system.
  4. Click Create.

Results

Your data model opens. You can now start to use the data types that it contains in your decision service. For more information, see Using data models in other decision artifacts.