azure-functions-extensions-swashbuckle
azure-functions-extensions-swashbuckle copied to clipboard
Does not work with Functions v3
I get the following error.
A host error has occurred during startup operation 'a9f43d8a-89ae-4480-8c8f-9b6b8ad75098'. [5.12.2019 14:46:13] AzureFunctions.Extensions.Swashbuckle: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.DefaultValidationMetadataProvider' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Same here!
the same issue(((
ummmm. very difficult.
@yuka1984 do you know what the underlying problem is? Maybe we can help
@LockTar An error occurred because the namespace of DefaultValidationMetadataProvider changed. I am trying to solve it by preparing my own DefaultValidationMetadataProvider. But, this method is not clean. Do you have any other good ideas?
@yuka1984 I have already try your new privew 1.4.5 version. But I got a new error: {"Could not load type 'Swashbuckle.AspNetCore.Swagger.SwaggerDocument' from assembly 'Swashbuckle.AspNetCore.Swagger, Version=5.0.0.0, Culture=neutral, PublicKeyToken=62657d7474907593'.":"Swashbuckle.AspNetCore.Swagger.SwaggerDocument"}
As I understand, we need to update Swashbuckle.AspNetCore to -Version 5.0.0-rc5.
@yuka1984 What is the status on this?
@vvboxplosive @kjartanvalur I'm sorry. My fix was not valid. It seems difficult to create a library of the same version corresponding to Function v2 and v3. I am planning to update the version of this package to 3.0 to support FunctionsV3. This package will not support FunctionsV2.
@yuka1984 Thanks for the info
Good morning! You could release a version "2.0" for the package to work with functions v2, without changes in the package. Then you could release the version "3.0" to work with functions v3. I think it would be good because it's more intuitive for us (users in general). I tried to figure out the problem to give a possible solution, but unfortunately I didn't have much time...
Fixed it in the fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle As I needed Nuget asap. (AzureExtensions.Swashbuckle) Can merge it later here if required
Fixed it in the fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle As I needed Nuget asap. (AzureExtensions.Swashbuckle) Can merge it later here if required
I did that and It works well, but now the RequestBodyType is not working, do you know any workaround that?
Any progress on this issue?
@yuka1984 any updates?
@yuka1984 Any updates on this issue for Azure Functions v3?
Bump, any updates ?
So I did some research, the issue is caused by a missing ModelMetadata in the ApiParameterDescription. I made a fork of the fix from vitalybibikov and added this object.
@yuka1984 A working version is in https://github.com/mligtenberg/azure-functions-extensions-swashbuckle Please feel free to merge it back.
@mligtenberg @yuka1984 is it possible to merge it to the NuGet package?
So I did some research, the issue is caused by a missing ModelMetadata in the ApiParameterDescription. I made a fork of the fix from vitalybibikov and added this object.
@yuka1984 A working version is in https://github.com/mligtenberg/azure-functions-extensions-swashbuckle Please feel free to merge it back.
@mligtenberg Thank you very much, everything seems to be working perfectly. @yuka1984, is it possible to merge it to master and incorporate it to the NuGet package?
Fixed it in the fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle As I needed Nuget asap. (AzureExtensions.Swashbuckle) Can merge it later here if required
I did that and It works well, but now the RequestBodyType is not working, do you know any workaround that?
Same issue for me, I opened a new Issue #30 to over it.
I opened a new issue because the solution here did work for me, but now I have an issue with RequestBody.
Thanks all
Fixed it in the fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle As I needed Nuget asap. (AzureExtensions.Swashbuckle) Can merge it later here if required
I did that and It works well, but now the RequestBodyType is not working, do you know any workaround that?
Same issue for me, I opened a new Issue #30 to over it.
I opened a new issue because the solution here did work for me, but now I have an issue with RequestBody.
Thanks all
Did you try my fork? I haven't published it to NuGet yet. But there is a fix in there for the request body issue
Fixed it in the fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle As I needed Nuget asap. (AzureExtensions.Swashbuckle) Can merge it later here if required
I did that and It works well, but now the RequestBodyType is not working, do you know any workaround that?
Same issue for me, I opened a new Issue #30 to over it. I opened a new issue because the solution here did work for me, but now I have an issue with RequestBody. Thanks all
Did you try my fork? I haven't published it to NuGet yet. But there is a fix in there for the request body issue
I hope you can make a new published in Nuget soon, I tested your changes last week and all work good, I am excited to include them in my solution!
I made a package available on NuGet called AzureFunctions.Swashbuckle for those who need a fix now. It contains the fixes of vitalybibikov and my own fixes
@mligtenberg Thanks you! Merged your changes and updated.
The only thing that I had changed and published in NuGet is SupportedRequestFormat attribute fix.
As far as I can see, your solution requires code changes, with addition of
[SupportedRequestFormat("application/json")]
above every single function.
Due to the fact, that in MVC, "application/json" media type was a default supported one. I've made it the same way => so if you do not have the attribute specified => "application/json" is set by default.
Thus no code changes, except for update is required.
Sorry for the wait, here is the NuGet: https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle/releases/tag/3.0.0
Perfect, I'm unlisting my temporary package as we speak.
I have spotted an issue in the new nuget package. I am not sure if this is already in the original library, but parameters in the url definition should exactly match the parameter in the body. Otherwise it won't show up in the parameters. {id:minlength(10)} doesn't work for example
@mligtenberg @vitalybibikov What package should I be using to make this work with v3 and .net core 3.1? The versions on nuget are 3 months old, yet said things are published?
This is the error when I use the v3 of the package or the 1.4.5 preview.
3/3/2020 5:15:10 PM] The 'Swagger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Swagger'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'swashBuckleClient' to type ISwashBuckleClient. Make sure the parameter Type is supported by the bin ding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
@bbakermmc You should use https://www.nuget.org/packages/AzureExtensions.Swashbuckle/ package at the moment.
Created from this fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle
You might also want to add
builder.AddSwashBuckle(Assembly.GetExecutingAssembly());
if you haven't
@vitalybibikov Yeah I have a startup class thats that same as your sample and still have the error.
I must have some bad references or something, added it to another project and seems to be working on that one.