Skip to main content

Importing OpenAPI Specification

In this section, you will learn how to import OpenAPI (Swagger) specifications into Apidog.

Apidog supports importingjson oryaml files inOpenAPI 3 andSwagger-2 data formats.

Ifsummary,operationId andpath parameters are all written within the same Swagger file, then during the import, the endpoint name will be set according to the priority ofsummary > operationId > path.

Manual Import

Open theSettings and click onImport Data to select either file import or URL import.

Manual Import - File Import

You can either drag and drop yourJSON orYAML files into the area shown below, or simply click the area to browse and select the desired file from your system’s file manager.

importing openapi data via upload

Manual Import - URL Import

When using URL import, please provide the direct URL to theJSON orYAML data file, not the Base URL of the Swagger UI.

swagger

importing from url

Import - Advanced Settings

The imported OpenAPI/Swagger specifications include only endpoints, schemas, and environments.

Import - Advanced Settings

When importing a file, you can set up the following options:

  1. Forder: Support importing files into specific folders.

    Forder

  1. Overwrite: When two files have the same Method and Path, the newer file will overwrite the older file.

    Overwrite

  2. Merge: When two files have the same Method and Path, any modified information from the old file, such as Mock rules, parameter descriptions, request examples, and response examples, will be retained.

  3. Overwrite Selected Fields: When two files have the same Method and Path, you can choose to overwrite specific fields. Other unselected fields will retain the existing data in Apidog.

    Overwrite Selected Fields

  4. Ignore: When two files have the same Method and Path, the new file will not be imported.

  5. Keep Both: When two files have the same Method and Path, the new file will be imported, and the old file will not be deleted.

  6. Import Cases: When this option is enabled, the test cases under the selected endpoints will be automatically selected by default. You can also manually choose the corresponding test cases in the import preview.

Schemaneed to be configured separately, including the selection of overwrite modes and the import folders.

Schema

To align the structure of your existing endpoints in Apidog with the folder structure of an imported Swagger file, simply enable theAnd update endpoint folder option. This will automatically adjust the current folder structure to match the imported file.

Update Endpoint Folder

Scheduled Import

Open theSettings panel, go toImport Data, and click onScheduled. You can select multiple data sources here and synchronize them to a specific folders at regular intervals.

tip

TheImport Dataoption is only visible and accessible to project admins.

auto sync