KB Article #181555

Original service definition will not be available errors post-upgrade

Problem

After upgrading, you start seeing errors like the following on startup:


ERROR 01/Jan/2021:00:00:00.000 [0000:000000000000000000000000] Error loading API: MyAPI [00000000-0000-0000-0000-000000000000]. Original service definition will not be available:
com.vordel.api.common.BadRequestException: Unable to determine resource type 
at com.vordel.apiportal.config.ServiceRetriever.commit(ServiceRetriever.java:77)
at com.vordel.apiportal.config.StreamServiceRetriever.run(StreamServiceRetriever.java:22)


Resolution

This is happening because API Gateway uses upgraded Swagger libraries that do more validation now. Previously, nothing in the "models" section of a backend API was validated. Any invalid data imported from prior versions will make the gateway unable to produce valid Swagger for the service, causing this error. To resolve the error, you will need to fix any invalid data in the API's models.
Similar errors have also been seen on APIs that did not have a customized model, but some other required field from the specification was found to be missing.


When validating Swagger 2.0 or OAS 3, many Swagger tools and online sites can be used, such as https://editor.swagger.io/ or https://apitools.dev/swagger-parser/online/.


However, the upgrade error seen with this KB is most often associated with older Swagger 1.x version APIs. Few tools exist that can parse and validate Swagger 1.x. And the Swagger 1.x specification itself is somewhat hard to find online, try: OpenAPI-Specification/1.2.md at main · OAI/OpenAPI-Specification · GitHub


One tool that can help with validating Swagger 1.x is Swagger Codegen. NOTE, use the 2.x version. This can be used to find the model or api definition problems in your Swagger 1.x APIs so that you can fix them, which can then resolve the API Gateway error.

Example:

java -jar swagger-codegen-cli.jar validate -i MyAPI.json