product-apim icon indicating copy to clipboard operation
product-apim copied to clipboard

Inform reason openapi spec is not valid on upload.

Open emiliobristech opened this issue 4 years ago • 4 comments

Describe your problem(s)

I'm trying to create a new API based on generated openapi definition. When I upload it, I get an useless error information:

OpenAPI content validation failed!

It would be very useful to get more info about the reason that openapi spec is not valid since it doesn't seems to be invalid based on test I did in https://apitools.dev/swagger-parser/online/.

Describe your solution

Show detailed information about the reason openapi spec is not valid.

How will you implement it

Just show more info.


emiliobristech avatar Jan 20 '21 20:01 emiliobristech

Hi @emiliobristech

Thanks for bringing this up, The error information is right there in the REST API response

image

But we haven't pass/show that information to the portal users.

We could improve the current error message to include the available error details

I:e :

This is how it shows in Swagger Editor image

tmkasun avatar Jan 26 '21 08:01 tmkasun

Hello, thank you for your response and suggestion! It would be great if any additional information comes with error message. In my particular case, what was happening is that I have generated openApi in Windows PowerShell, for an unknown reason, it was adding invisible characters to generated openapi spec file. In this case, a message such as "Invalid file format" or "Cannot read file" would be welcome. I had to create a new file copy and paste small parts of content to understant where the error was. In the end, the error was in file itself and solved creating new file with same content but I've lost couple of hours finding out what was wrong.

emiliobristech avatar Feb 01 '21 18:02 emiliobristech

Guys, I did some tests in v4.1.0 now, there is no message when open api spec is invalid. It deploys successfuly but API always returns 404. When I check logs, there are messages that indicates open apispec is invalid. As I use API Product, there is no additional information about which API is invalid.

This lack of feedback is really bad for usability since we don't know what is happening.

emiliobristech avatar Jun 20 '22 13:06 emiliobristech

Hi @emiliobristech ,

In 4.1.0 we now have the following Show errors button which lists down all the OAS spec errors

image

image

can you please attach the erroneous OAS definition or a sample OAS definition which we can reproduce your scenario ?

tmkasun avatar Jun 21 '22 03:06 tmkasun