Create Schema
In data models, interface input parameter definitions, or interface response expectation definitions, data structures are often used to visually define jsonschema for designing interfaces.
Create Data Model
New Model Entry
- Model Name: Required and must be unique, usually composed of letters, numbers, and underscores.
- Alias: Usually a name for easier searching and viewing.
- Directory: Models can be categorized for management.
- Remarks: Used to describe the purpose of the model.
Edit Data Model
You can visually edit the schema with the following options:
- Add or remove nodes
- You can modify field types
- Set whether a field is required or can be left empty
- Define the mock type of a field
- Rearrange the order of the fields
Intelligent Import
For existing structure files, you can quickly generate the structure of the JSON Schema
through intelligent import, avoiding tedious manual input. Supported formats include JSON
, XML
, JSON Schema
, and MySQL DDL
.
Json Example
{
"userInfo_get_response": {
"result": {
"model": {
"open_id": "qwertyuiuduiasd",
"avatar": "avatar url",
"nick": "snsNick"
},
"err_message": "err_message",
"err_code": "err_code",
"success": false
}
}
}
Xml Example
<error_response>
<code>50</code>
<msg>Remote service error</msg>
<sub_code>isv.invalid-parameter</sub_code>
<sub_msg>Illegal parameter</sub_msg>
</error_response>
Jsonschema Example
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person Schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the person.",
"minLength": 2
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
},
"email": {
"type": "string",
"description": "The email address of the person.",
"format": "email"
}
},
"required": ["name", "age", "email"]
}
Mysql DDL Example
CREATE TABLE orders (
order_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT NOT NULL,
order_date DATE NOT NULL,
total_amount DECIMAL(10, 2) NOT NULL,
status VARCHAR(50) NOT NULL,
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
);
Advanced Field Settings
In addition to basic settings, such as whether a field is required or allows null values, certain field types support advanced options. You can also set field properties directly through source code editing. For example, for arrays, you can specify the number of items and other properties.
String
Number
Array
Object
Boolean
Integer
Oneof, Anyof, Allof
Reference Data Model
When adding child nodes, you can quickly reference existing data models.
Select an existing schema.
The schema will automatically follow changes in the original data source. If you do not want this synchronization, you can disassociate the reference.
Preview
Preview the json content generated by the data structure.
Raw Editing
Design data structures by editing jsonschema source code.