Burgyn / MMLib.SwaggerForOcelot

This repo contains swagger extension for ocelot.
MIT License
352 stars 94 forks source link

Failed to load API definition - value cannot be null #286

Open jaltenbernd opened 9 months ago

jaltenbernd commented 9 months ago

Getting the "Failed to load API definition" for my .NET 8 Azure Function Out-of-Process. For that, I have to use the library: Microsoft.Azure.Functions.Worker.Extensions.OpenApi instead of the Swagger pkg for WebAPIs.

My SwaggerEndPoint URL to the swagger.json file for this one API is correct. All my others APIs come up fine, but this is the only one I have as an Azure Function. Is that the issue? Too new?

The error log is:

SpanId: 2717d8553f5ab08f
TraceId: 9a968178b49be163e93bd71dd11d3aa1
ParentId: 0000000000000000
ConnectionId: 0HN0GLREKVDEB
RequestId: 0HN0GLREKVDEB:0000000B
RequestPath: /swagger/docs/v1/tenant

An unhandled exception has occurred while executing the request.

Exception: 
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.Cast[TResult](IEnumerable source)
   at MMLib.SwaggerForOcelot.Transformation.SwaggerJsonTransformer.RemoveItems[T](JToken token, JToken paths, Func`2[] searchPaths)
   at MMLib.SwaggerForOcelot.Transformation.SwaggerJsonTransformer.TransformSwagger(JObject swagger, IEnumerable`1 routes, String hostOverride, SwaggerEndPointOptions endPointOptions)
Burgyn commented 9 months ago

Hi @jaltenbernd ,

Please add ocelot.json and dowstream OpenAPI json documentation with minimal configuration to reproduce this error.

Thanks.