Skip to content

import of openapi 3.0.0 api with references #557

@themikebe

Description

@themikebe

APIM-CLI version

1.14.11

API-Management version

7.7.20211130

Question

Good morning,

I'm not sure if this is a bug, so I'll open it as question.

When we try to import the following Open-Api 3.0.0 api composed of several files with relative references

├── bulk-api-v1.yaml
           paths:
             /health:
               $ref: "./common/v1/common-v1.yaml#/paths/~1health"
├── common
│   └── v1
│       └── common-v1.yaml
├── link
│   └── v1
│       └── link-v1.yaml
├── problem
│   └── v1
│       └── problem-v1.yaml
└── validation-v1.yaml

import fails with the following message:

2025-06-30 10:53:30,496 [APIManagerAPIAdapter] ERROR: Error importing API-Specification (Open API 3.0 (YAML)) to create Backend-API using URI: https://lesbgwayd01.lx.finbel.intra:10175/api/portal/v1.4/apirepo/import/ Received Status-Code: 400 Response: {"errors":[{"code":400,"message":"Malformed OAS3 document: Unable to load RELATIVE ref: ./common/v1/common-v1.yaml path: ."}]}
2025-06-30 10:53:30,503 [APIImportApp] ERROR: Can't import definition / Create BE-API.
                                 | Can't import API-Specification to create Backend-API.
com.axway.apim.lib.error.AppException: Can't import definition / Create BE-API.
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.importBackendAPI(APIManagerAPIAdapter.java:863)
        at com.axway.apim.apiimport.actions.CreateNewAPI.execute(CreateNewAPI.java:49)
        at com.axway.apim.apiimport.APIImportManager.applyChanges(APIImportManager.java:47)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:130)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:57)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:133)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:72)
Caused by: com.axway.apim.lib.error.AppException: Can't import API-Specification to create Backend-API.
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.createBackend(APIManagerAPIAdapter.java:926)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.importFromSwagger(APIManagerAPIAdapter.java:914)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.importBackendAPI(APIManagerAPIAdapter.java:855)
        ... 10 more

I was wondering if apim-cli was able to handle these relative references in the first place or if this was a bug.

additional observations are that

  • import does work when the specification is bundled into 1 file, this is the work-around we use.
  • import also works when using the "Import Api > import swagger API > import from Swagger definition URL".

Many thanks for your input and your help !
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions