Summary
When importing an OpenAPI file into a sprint branch, the import ignores the specified branch and writes all resources to the main branch instead. The target sprint branch remains empty.
This happens with both the CLI (apidog import --branch <name>) and the REST API (POST /v1/projects/{id}/import-openapi with targetBranchId). It occurs whether the branch is specified by name or by numeric id, and it persists with External AI Edit Permissions enabled.
Importing through the desktop UI (with the branch selected in the top-left) works correctly. Only the programmatic paths are affected, which means there is currently no way to import a spec into a sprint branch from CI.
This looks like a regression or gap in issue #112 ("Sprint Branch supports import/export").
Environment
- apidog-cli version 2.2.8 (current latest).
- Also reproduced directly against the REST API (
api.apidog.com, header X-Apidog-Api-Version: 2024-03-28), so the behaviour is server-side rather than CLI-specific.
Steps to reproduce
-
Create an empty sprint branch:
apidog branch create --project <projectId> --type sprint --name feat-x --from main
-
As a control, create a single endpoint on that branch. This works correctly and isolates to the branch:
apidog endpoint create --project <projectId> --branch feat-x --file one-endpoint.json
Result: the main branch endpoint count is unchanged; the sprint branch gains one endpoint.
-
Import an OpenAPI file into the same branch:
apidog import --project <projectId> --branch feat-x --format openapi --file spec.yaml
Result: the main branch endpoint count increases; the sprint branch remains empty.
-
Confirm where the resources landed:
apidog endpoint list --project <projectId> --branch main # contains the imported endpoints
apidog endpoint list --project <projectId> --branch feat-x # returns 0
Observed results
Using a spec containing 3 endpoints and 2 schemas, imported into a newly created, empty sprint branch:
| Action |
Resources added to main |
Resources added to the sprint branch |
endpoint create --branch feat-x (control) |
none |
the single endpoint (isolated correctly) |
import --branch feat-x |
all 3 endpoints and 2 schemas |
none |
REST import-openapi with targetBranchId |
all imported resources |
none |
import --branch <numeric branch id> |
all imported resources |
none |
The important detail is that endpoint create --branch isolates correctly while import --branch does not, using the same flag, the same branch, and the same default module. This rules out branch resolution, module, and permissions as the cause, and points to the import operation specifically.
Expected behaviour
import --branch <name> and the REST import-openapi call with targetBranchId should place the imported endpoints and schemas on the specified sprint branch, leaving the main branch unchanged, as endpoint create --branch and the UI import already do.
Actual behaviour
All imported resources are written to the main branch, and the target sprint branch stays empty.
Impact
This blocks any CI or pipeline workflow that imports a spec into a per-feature sprint branch, for example to keep a feature branch's mock and documentation isolated from main.
Summary
When importing an OpenAPI file into a sprint branch, the import ignores the specified branch and writes all resources to the main branch instead. The target sprint branch remains empty.
This happens with both the CLI (
apidog import --branch <name>) and the REST API (POST /v1/projects/{id}/import-openapiwithtargetBranchId). It occurs whether the branch is specified by name or by numeric id, and it persists with External AI Edit Permissions enabled.Importing through the desktop UI (with the branch selected in the top-left) works correctly. Only the programmatic paths are affected, which means there is currently no way to import a spec into a sprint branch from CI.
This looks like a regression or gap in issue #112 ("Sprint Branch supports import/export").
Environment
api.apidog.com, headerX-Apidog-Api-Version: 2024-03-28), so the behaviour is server-side rather than CLI-specific.Steps to reproduce
Create an empty sprint branch:
As a control, create a single endpoint on that branch. This works correctly and isolates to the branch:
Result: the main branch endpoint count is unchanged; the sprint branch gains one endpoint.
Import an OpenAPI file into the same branch:
Result: the main branch endpoint count increases; the sprint branch remains empty.
Confirm where the resources landed:
Observed results
Using a spec containing 3 endpoints and 2 schemas, imported into a newly created, empty sprint branch:
endpoint create --branch feat-x(control)import --branch feat-ximport-openapiwithtargetBranchIdimport --branch <numeric branch id>The important detail is that
endpoint create --branchisolates correctly whileimport --branchdoes not, using the same flag, the same branch, and the same default module. This rules out branch resolution, module, and permissions as the cause, and points to the import operation specifically.Expected behaviour
import --branch <name>and the RESTimport-openapicall withtargetBranchIdshould place the imported endpoints and schemas on the specified sprint branch, leaving the main branch unchanged, asendpoint create --branchand the UI import already do.Actual behaviour
All imported resources are written to the main branch, and the target sprint branch stays empty.
Impact
This blocks any CI or pipeline workflow that imports a spec into a per-feature sprint branch, for example to keep a feature branch's mock and documentation isolated from main.