Build API Docs with Apidog
  1. Schemas
Build API Docs with Apidog
  • Overview
  • REST API Documentations
    • Basics
      • API-Design First Approach
      • Specify an endpoint
      • Components
      • Common parameters
      • Global parameters
      • Schemas
        • Overview
        • Create a new schema
        • Build a schema
        • Generate Schemas from JSON etc.
    • Advanced features
      • Custom endpoint fields
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
    • Example: Pet Store
      • Get user info
      • Find pet by ID
      • Add a new pet to the store
      • Update an existing pet
      • Deletes a pet
      • Finds Pets by status
  • SOAP API Documentations
    • How to Use Apidog to Write SOAP API Documentation
    • Example: WebService
      • WebService: Number To Words
      • SOAP: Add integers
      • SOAP/WSDL: Ebay
    • Example: Mastercard
      • Purchase Request
      • Submit a purchase request
  • GraphQL Documentation
    • How to Write GraphQL API Documentation Using Apidog
    • Example: Github
      • Introduction to GraphQL
      • Queries
      • Public schema
  • WebSocket Documentations
    • How to Use Apidog to Write WebSocket API Documentation
    • Example: Coinbase
      • Overview
      • Channel
  • SSE API Documentations
    • Example: Anthropic
      • Streaming Messages
      • Messages
  • gRPC API Documentations
    • How to Use Apidog for gRPC API Documentation and Testing
    • Example: Proto Documentation
      • Protocol Documentation
  1. Schemas

Generate Schemas from JSON etc.

When creating a schema, Apidog offers a very useful tool that allows you to quickly identify and create a schema from existing data. By clicking on Generate from JSON etc., you enter the data structure import tool.
Here, you can paste in your JSON, XML, JSON Schema and Import from Database, and Apidog will automatically generate a schema based on that data.

Generate from JSON/XML#

For JSON/XML, all you need to do is paste the existing JSON or XML into the designated area, and it will be automatically recognized and converted into the corresponding schema and data types.
JSON smart recognition serves to generate data structures based on the provided JSON, without saving the values contained within the JSON itself.
All properties appearing in JSON/XML will be treated as required.
Fields like description and mock will be left blank.

Overwrite mode#

When a schema is Generated from JSON for the second time , the newly imported data will overwrite the existing schema that has already been generated. In this scenario, there are two Overwrite modes:
Merge (Default): When a matching key is found, the mock and description from the original schema will be retained.
Overwrite: All existing data will be discarded, and the new data will completely replace the old data.

Naming style#

You can choose proper naming style:
Keep it as is
camelCase
PascalCase
snake_case

Save as example#

When using Generate from JSON in the Request body or Response, enabling Save as Example will include the current JSON/XML as a Request/Response Example when generating the schema.

Generate from JSON Schema#

Simply pasting a JSON Schema allows for visual recognition of the data structure.

Import from database#

Apidog supports two methods of generating schemas from database tables. The first method involves directly connecting to the database to read the table structures, while the second method entails pasting SQL DDL to recognize the table structure.

Database connections#

To import schema from databases, follow these steps:
1
Set up the database connection. Learn more about Manage Database Connection.
Apidog Free supports MySQL, SQL Server, Oracle, and PostgreSQL databases, while the paid version also includes support for ClickHouse, MongoDB, and Redis.
2
Select the database connection in Import from database.
3
Select the tables to import.
4
Configure the import options. For specific configuration settings, refer to the previous sections on JSON/XML handling.
When the Follow database field length toggle is enabled, Apidog will set the minimum and maximum property length values based on the field lengths defined in the table.

Enter SQL(DDL)#

Paste the database table CREATE statement (DDL) to generate the schema. Support SQL that Compatible with MySQL.
For specific configuration settings, refer to the previous sections on JSON/XML handling.
Modified at 2025-03-24 11:30:40
Previous
Build a schema
Next
Custom endpoint fields
Built with