Skip to content

'swaggerRelaxedValidation' mode doesn't work when the 'info' tag is null in the swagger #3852

Open
@nadeepoornima

Description

@nadeepoornima

Description

If the "info" object is missing in the swagger, it is identified as an invalid swagger even though the "swaggerRelaxedValidation" mode is enabled on the APIM server. Therefore, APICTL can't import such APIs to the target environment even though the APIM server started with the 'swaggerRelaxedValidation' mode.

  • Error:
Status: 400 
Response: {"code":900754,"message":"Error while parsing OpenAPI definition","description":"attribute openapi is missing. Invalid OpenAPI V3 definition found. java.lang.NullPointerException: Cannot invoke \"io.swagger.models.Info.getTitle()\" because \"info\" is null","moreInfo":"","error":[]}
apictl: Error importing API Reason: 400 

This issue happens because we try to get the properties of the info object in the API definition and set it to the validation response object. As we have already set the validation as true due to the swaggerRelaxedValidation property, these lines execute.

Steps to Reproduce

  • Create an API without having an info tag in APIM 3.2.0 or lower version.
  • Migrate the data to the latest APIM 4.3.0
  • Use the APICTL to export this API and import
  • Import part will fail

Version

A{IM 4.3.0

Environment Details (with versions)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions