Giter VIP home page Giter VIP logo

Comments (33)

 avatar commented on July 26, 2024 6

I am getting this error with:
Swashbuckle.Core" version="5.4.0"
Swashbuckle.OData" version="2.18.3"

from swashbuckle.odata.

odelljl avatar odelljl commented on July 26, 2024 1

I'm having the same problem with the following versions:
Swashbuckle.Core" version="5.4.0"
Swashbuckle.OData" version="2.18.4"

from swashbuckle.odata.

 avatar commented on July 26, 2024 1

@danroot Do you know what the resolution is? If so, can you submit a pull request or just explain clearly how to reproduce and I can fix today.

from swashbuckle.odata.

juergstaub avatar juergstaub commented on July 26, 2024

Ok, found it, Swashbuckle.OData 2.16.0 is not compatible with Swashbuckle.Core 5.3.1, you need Swashbuckle.Core 5.2.2 instead. The reason is that the SchemaRegistry class editor changed the sequence of arguments.

from swashbuckle.odata.

 avatar commented on July 26, 2024

Hi Jürg, thanks for posting this issue. I'll try to make the latest Swashbuckle.OData compatible with the latest Swashbuckle.Core. I hate having to use reflection for just this reason. Wasn't a reflection issue. Looks like Swashbuckle.Core actually made a backwards-incompatible change on a public class/constructor.

from swashbuckle.odata.

 avatar commented on July 26, 2024

Opened domaindrivendev/Swashbuckle.WebApi#650 to see if the author can revert to the previous parameter order. For now I will update Swashbuckle.OData to a strict dependency on Swashbuckle.Core v5.2.2.

from swashbuckle.odata.

 avatar commented on July 26, 2024

v2.16.2 now specifies a hard dependency on Swashbuckle.Core v5.0.0-5.2.2.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

Created pull request in Swashbuckle to fix this issue. domaindrivendev/Swashbuckle.WebApi#652

from swashbuckle.odata.

ivanko2000 avatar ivanko2000 commented on July 26, 2024

Same problem as for @ac4simms

from swashbuckle.odata.

AntonioBou avatar AntonioBou commented on July 26, 2024

Hi I am also having the same problem as @ac4simms, with the same versions.

from swashbuckle.odata.

figuerres avatar figuerres commented on July 26, 2024

Same here, tried to update and it broke.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

I'll check it out. thanks.

from swashbuckle.odata.

danroot avatar danroot commented on July 26, 2024

Seeing this too and wind up in package hell when trying to resolve. Swashbuckle.Core 5.3.2 doesn't support EnableApiKeySupport, so I need 5.4.0.

from swashbuckle.odata.

danroot avatar danroot commented on July 26, 2024

I'm not to where I can do a pr just yet, but will try to get the code and do that in the future. In the meantime, I suspect the issue is same as before - ODataSwaggerProvider.GetSwagger's call to the SchemaRegistry constructor fails because Swashbuckle.Core changed the constructor parameters.

Steps to repro:

  • VS -> New -> ASP.NET -> Check Web API
  • Install-Package Swashbuckle.OData
  • Install-Package Swashbuckle.Core (this will update to 5.4.0)
  • Add minimal Swashbuckle config to WebApiConfig:

config
.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "https://api.company.com");
c.ApiKey("Token")
.Description("Filling bearer token here")
.Name("Authorization")
.In("header");
c.CustomProvider(defaultProvider => new ODataSwaggerProvider(defaultProvider, c));
})
.EnableSwaggerUi(c =>
{
c.EnableApiKeySupport("Authorization", "header");
//TODO: Note for Bearer token to work, you'd need to inject some custom js here, omitted for these repro steps
});

  • Ctrl-F5, browse to /swagger/ui/index
  • Observe exception:

ExceptionMessage":"Method not found: 'Void Swashbuckle.Swagger.SchemaRegistry..ctor(Newtonsoft.Json.JsonSerializerSettings, System.Collections.Generic.IDictionary2<System.Type,System.Func1<Swashbuckle.Swagger.Schema>>, System.Collections.Generic.IEnumerable1<Swashbuckle.Swagger.ISchemaFilter>, System.Collections.Generic.IEnumerable1<Swashbuckle.Swagger.IModelFilter>, Boolean, System.Func`2<System.Type,System.String>, Boolean, Boolean)'.","ExceptionType":"System.MissingMethodException","StackTrace":" at Swashbuckle.OData.ODataSwaggerProvider.GetSwagger(String rootUrl, String apiVersion)\r

  • Expected behavior: no exception ;)

It sounds like Swashbuckle.Swagger.SchemaRegistry is really to 'blame' because the public constructor in a non-backwards-compatible way. One fix that might prevent this from being a problem again is a static factory method on SchemaRegistry so that developers aren't as tempted to change the constructor (or get a build error if they do ;). Then in OdataSwaggerProvider.GetSwagger, the call would be:

var schemaRegistry = SchemaRegistry.Create(...)

A constructor overload would work as well. Either should probably have copious comments to remind Swashbuckle.Core developers that Swashbuckle.OData depends on the overload...

Alternatively, some change to OdataSwaggerProvider.GetSwagger to use the newer constructor, though that would then mean the packaging should require .Core >= 5.4.0, and the risk would remain of SchemaRegistry changing in 5.5.0 ;)

from swashbuckle.odata.

codegrue avatar codegrue commented on July 26, 2024

I am also getting this issue still with
Swashbuckle.Core" version="5.4.0"
Swashbuckle.OData" version="2.18.4"

Does anyone know a functional combination to use of older versions?

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

@codegrue The latest working combo is:
Swashbuckle.Core" version="5.3.2"
Swashbuckle.OData" version="2.18.3"

from swashbuckle.odata.

codegrue avatar codegrue commented on July 26, 2024

@brutaldev Just tried that and now I am getting a "Method not found" error in the Microsoft.OData namespace (v7.0.0). I wonder if I need an older version of this also?

Specifically:

Method not found: 'Microsoft.OData.Edm.IEdmModel System.Web.OData.Routing.ODataPathRouteConstraint.get_EdmModel()'.",

"ExceptionType":"System.MissingMethodException",

"StackTrace":" at Swashbuckle.OData.Descriptions.ODataRouteExtensions.GetEdmModel(ODataRoute oDataRoute)...

from swashbuckle.odata.

figuerres avatar figuerres commented on July 26, 2024

we have last I looked at this a chain of depends on old versions of everything.....
In My project I have a set of working packages and I will not change them until I know for sure this has been fixed.
this is the problem of multiple packages from different teams and no one having time to manage the different interfaces and specs.
in my project what I have is:

Swashbuckle 5.3.2
Swashbuckle.OData 2.18.2
Microsoft.OData.Core 6.15
Microsoft.ASpNet.OData 5.9.1
Flurl 0.1.0

each have updates but I can't use them due to different conflicts with the updated packages.

for now use the versions I have given and it should all work.

that's my $0.02 on this...

from swashbuckle.odata.

codegrue avatar codegrue commented on July 26, 2024

Thank you. I reverted everything and it broke RESTier. Ugh. Wish Swashbuckle would support the latest APIs for these other libraries.

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

OData 7 breaks everything, don't upgrade to that yet until people have had a chance to update their libs.

This is the version combo I use, as new as possible without anything breaking

Swashbuckle 5.3.2
Swashbuckle.OData 2.18.4
Microsoft.OData.Core 6.15
Microsoft.ASpNet.OData 5.9.1
Flurl 1.1.2

from swashbuckle.odata.

figuerres avatar figuerres commented on July 26, 2024

@brutaldev : will try the updated versions you have when I can and see if they also are ok on my project.

@codegrue : RESTier, i tried that at one point but was not able to do what I needed.
in my system i have a generic class that does most of the work and make sure that some key columns in the database are updated on each update etc.... RESTier looked nice but when I got it I found it was not really done, needed more "Cooking time" :--)

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

I'll update Swashbuckle.OData to constrain the versions per @brutaldev. Thanks for researching, everyone.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

Dependency versions now constrained in v2.18.5: https://www.nuget.org/packages/Swashbuckle.OData/2.18.5

Will close this ticket in a few days unless I hear of any issues. Thanks!

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

@rbeauchamp When updating to 2.18.5, it crashes IIS Express with the following error: https://brutaldev.com/download/SODATA-2185-Error.png

sodata-2185-error

Only this combination seems to work well:

Swashbuckle 5.3.2
Swashbuckle.OData 2.18.4
Microsoft.OData.Core 6.15
Microsoft.ASpNet.OData 5.9.1
Flurl 1.1.2

Your NuGet package should be constrained with something like this:

>= 6.1.5 and < 7.0.0 Microsoft.OData.Core
>= 5.7.0 < 6.0.0 Microsoft.ASpNet.OData (6.0.0 relies on OData 7.0.0)
< 5.4.0 Swashbuckle

from swashbuckle.odata.

 avatar commented on July 26, 2024

Sorry, that error is my bad. Don't have CodeContracts installed on my new machine. :-(

I'll get a new package built and pushed.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

Ok. Package v2.18.5 has been de-listed.

Please retry with v2.18.6.

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

@rbeauchamp Installed and tested. The following combination can now be used (the NuGet package does not constrain things enough to avoid going up in major versions):

Swashbuckle 5.3.2
Swashbuckle.OData 2.18.6
Microsoft.OData.Core 6.15
Microsoft.ASpNet.OData 5.9.1
Flurl 1.1.2

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

@brutaldev Thanks for testing! Looks like I need to constrain Microsoft.AspNet.OData too. Then we should be all set.

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

@rbeauchamp I added my suggested constraints above based on what's out there right now:

>= 6.1.5 and < 7.0.0 Microsoft.OData.Core
>= 5.7.0 < 6.0.0 Microsoft.AspNet.OData (6.0.0 relies on OData 7.0.0)
< 5.4.0 Swashbuckle

Your current constraints:
Flurl (< 2.0.0) <- Good
Microsoft.AspNet.OData (>= 5.7.0) <- Not Good, needs to be < 6.0.0 because 6.0.0 relies on MS OData 7+
Microsoft.AspNet.WebApi.Client (>= 5.2.3) <- Good, but probably safer to also be < 6.0.0
Microsoft.AspNet.WebApi.Core (>= 5.2.3) <- Good, but probably safer to also be < 6.0.0
Microsoft.AspNet.WebApi.WebHost (>= 5.2.3) <- Good, but probably safer to also be < 6.0.0
Newtonsoft.Json (>= 7.0.1) <- Good
Microsoft.OData.Core (= 6.15.0) <- Bit too strict since these have always been safe, rather go < 7.0.0*
Microsoft.OData.Edm (= 6.15.0) <- Bit too strict since these have always been safe, rather go < 7.0.0*
Microsoft.Spatial (= 6.15.0) <- Bit too strict since these have always been safe, rather go < 7.0.0*
Swashbuckle.Core (= 5.3.2) <- Bit too strict, only 5.4.0 breaks thing, probably safe to go < 5.4.0

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

Great. Thanks for the recommendations. I'll apply those constraints.

from swashbuckle.odata.

brutaldev avatar brutaldev commented on July 26, 2024

No problem, would probably have been faster to just PR those changes for you, but I'm feeling wrecked today and need some sleep... Thanks again for the great lib, I rely on it so much I'll jump through hoops and stay on older versions of things just to keep this working.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

You're welcome. Thanks, this is fine. Go get some sleep! ;-)

On Tue, Sep 27, 2016, 11:44 AM Werner van Deventer [email protected]
wrote:

No problem, would probably have been faster to just PR those changes for
you, but I'm feeling wrecked today and need some sleep... Thanks again for
the great lib, I rely on it so much I'll jump through hoops and stay on
older versions of things just to keep this working.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#68 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAcwbXMdYCx1APQ-Bs3XpoPtfmGAVxs6ks5quWQOgaJpZM4HaLPH
.

from swashbuckle.odata.

rbeauchamp avatar rbeauchamp commented on July 26, 2024

Latest package constraints per @brutaldev are avialable in https://www.nuget.org/packages/Swashbuckle.OData/2.18.8

from swashbuckle.odata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.