Skip to main content

Shared Data Model Concept

Shared Data Model enables you to create reusable schema definitions in API Designer’s spec first approach. By creating shared schema models that define data types in message content, you can use model inheritance and shared components with JSON Schema references. Created models can be imported and used within the Spec Design Editor.

Reusable Schemas

Shared schema models are createdThe same data structure can be used in multiple APIs.

Model Inheritance

Model inheritance and referencesModel relationships with JSON Schema references.

Shared Components

Shared components are usedCommon data types are managed centrally.

Spec Design Editor Integration

Usage in Spec Design EditorCreated models can be imported into API Specs.

Shared Data Model Features

Schema Design

Schema design and property management in shared data models:
  • Basic data types (string, integer, number, boolean)
  • Complex data types (object, array)
  • Enum values
  • Format definitions
  • Property definitions
  • Required fields
  • Read-only and write-only behaviors
  • Validation rules
  • Model references with $ref
  • Model inheritance
  • Shared components
  • JSON Schema references

Data Model Management

Creation and management of shared data models:

Model Creation

New shared data models are created
  • Defining name and description
  • Creating schema structure
  • Adding example values

Schema Properties

Properties are defined within the schema
  • Adding and editing properties
  • Determining type and format
  • Validation rules

Model Import

Models are used in Spec Design Editor
  • Model reference within Spec
  • Shared component usage
  • Reusability

Creating Shared Data Model

A new Data Model can be created by clicking the New (Create) button in the upper right of the list interface. List interface The Shared Data Model creation settings are shown in the following image: Shared Data Model creation settings The fields used for shared data model creation configuration are shown in the table below.
FieldDescription
NameThe name information of the data model.
DescriptionDescription related to the data model.
Schema (Schema)Properties and fields to be included in the data and properties such as type, pattern, min-max are managed.
Example (Example)An example of the data type can be created.

Adding Schema Property

You can define the structure of your data model by adding properties within the schema. The Schema Property addition settings are shown in the following image: Schema Property addition settings The fields used for Schema Property creation configuration are shown in the table below.
FieldDescription
NameThe name information of the schema.
DescriptionDescription can be made about the schema.
TypeField where the type of the schema is specified.
Format (Format)A field that is active according to the selected type. There are formats that can be selected for some types:

integer
- int32: Signed 32-bit integers (commonly used integer type).
- int64: Signed 64-bit integers (long type).

number
- float: Decimal numbers (6 digits).
- double: Decimal numbers (14 digits).

string
- byte: Base64 encoded characters. For example, U3dhZ2dlciByb2Nrcw==
- binary: Binary data used to define files
- date: Full date representation. For example, 2017-07-21
- date-time: Date-time representation. For example, 2017-07-21T17:32:28Z
- password: Used to mask input.
$Ref TargetIf $ref is selected from the type field, this field becomes active.

A reference to another data model can be given.
Property is (Property is)Specifies whether the model’s usage is required.
Behaviour (Behaviour)Determines the read-only/write-only information of the schema.
Integer Properties (Integer Properties)If Integer is selected as type, these fields become active:
- Minimum: To determine the smallest of the values that can be entered.
- Maximum: To determine the largest of the values that can be entered.
- MultipleOf: To determine this if the values to be entered are desired to be multiples of a number.
String Properties (String Properties)If String is selected as type, these fields become active:
- Pattern (Pattern): Allows you to define a regular expression template for the string value. Only values matching this template will be accepted.
- Min Length (Min Length): To determine the minimum length of values that can be entered.
- Max Length (Max Length): To determine the maximum length of values that can be entered.
Enum Values (Enum Values)If Enum is selected as type, this field becomes active.

Field where possible values of the model are entered.
Example (Example)An example describing the schema can be given.

Shared Data Model Usage Scenarios

Usage scenarios of shared data models in spec first approach:

Creating Reusable Schema

  1. Creating shared data model
  2. Defining schema properties
  3. Importing model in Spec Design Editor
  4. Using in multiple API Specs
  5. Central update and management

Model Inheritance and References

  1. Creating basic data models
  2. Establishing relationships with model references
  3. Model inheritance with $ref
  4. Using shared components
  5. Consistent data structures

Relationship Between Shared Data Model and Spec Design Editor

Shared Data Models work integrated with the Spec Design Editor. Workflow:
Shared Data Models

   │ Schema Definitions
   │ Model References


Spec Design Editor

   │ Model Import
   │ $ref References


API Spec

   │ Shared Components


API Proxy

1. Model Creation

Model is created on Shared Data Models pageSchema properties and structure are defined.

2. Model Definition

Schema properties and validation rules are determinedProperties, types, and formats are defined.

3. Usage in Spec

Model is imported in Spec Design EditorModel is used with $ref references.

4. Reuse

Model can be used in multiple API SpecsCentral management and consistency are ensured.
This integration between Shared Data Models and Spec Design Editor enables you to create consistent and centrally managed data structures with reusable schema definitions in spec first approach. Models are created once and can be used in multiple API Specs.

Shared Data Model Advantages

Advantages provided by reusable schema definitions:

Reusability

  • Same schema is used in multiple APIs
  • Central schema management
  • Consistent data structures

Model Inheritance

  • Model references with $ref
  • Model relationships and inheritance
  • Shared components

Central Management

  • Schema update from a single place
  • Changes reflected to all APIs
  • Version control

Standard Compliance

  • Compliance with JSON Schema standards
  • OpenAPI/Swagger compatibility
  • Tool support

Next Steps