Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade openapi to 1.2.2 (#154) #155

Merged
merged 3 commits into from
Jun 25, 2020
Merged

upgrade openapi to 1.2.2 (#154) #155

merged 3 commits into from
Jun 25, 2020

Conversation

CumpsD
Copy link
Contributor

@CumpsD CumpsD commented Jun 22, 2020

Fix for #154

@mattfrear
Copy link
Owner

Hmm, this looks like a bit of a mess. I guess the OpenApi developers thought that adding a new optional parameter is not a breaking change. I probably would have made the same mistake.

I've pulled down your fix locally and it's not working for me - I get the same MissingMethodException when I try to run the test API projects 🤷‍♂️

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 23, 2020

Yeah, optional parameters are a bit tricky :(

Hmm, do you get it after recompiling too? I'll double check, but after recompiling it binds to the new 2 parameter ctor normally.

Something for this evening :)

@mattfrear
Copy link
Owner

I didn't spend too long on it but yes I pulled down your changes, did a Build -> Clean, and still hit the exception.

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 24, 2020

Strange, I'll investigate some more

image

Ah but let me check running it :)

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 24, 2020

Ah but it seems now it is being thrown from Swashbuckle.AspNetCore.SwaggerGen and not this repo :)

System.MissingMethodException: Method not found: 'Void Microsoft.OpenApi.Any.OpenApiString..ctor(System.String)'.
   at Swashbuckle.AspNetCore.SwaggerGen.OpenApiAnyFactory.CreateFor(OpenApiSchema schema, Object value)
   at Swashbuckle.AspNetCore.SwaggerGen.JsonEnumHandler.<>c__DisplayClass4_0.<CreateSchema>b__1(Object value)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Swashbuckle.AspNetCore.SwaggerGen.JsonEnumHandler.CreateSchema(Type type, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.<>c__DisplayClass4_1.<GenerateSchema>b__0()
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaRepository.GetOrAdd(Type type, String schemaId, Func`1 factoryMethod)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.CreateReferenceSchema(Type type, SchemaRepository schemaRepository, Func`1 factoryMethod)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.GenerateSchema(Type type, SchemaRepository schemaRepository)   at Swashbuckle.AspNetCore.SwaggerGen.JsonObjectHandler.CreatePropertySchema(PropertyInfo property, IEnumerable`1 customAttributes, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.JsonObjectHandler.CreateObjectSchema(Type type, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.JsonObjectHandler.CreateSchema(Type type, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.<>c__DisplayClass4_1.<GenerateSchema>b__0()
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaRepository.GetOrAdd(Type type, String schemaId, Func`1 factoryMethod)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.CreateReferenceSchema(Type type, SchemaRepository schemaRepository, Func`1 factoryMethod)
   at Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorBase.GenerateSchema(Type type, SchemaRepository schemaRepository)   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateResponseMediaType(ModelMetadata modelMetadata, SchemaRepository schemaRespository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.<>c__DisplayClass18_0.<GenerateResponse>b__2(String contentType)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateResponse(ApiDescription apiDescription, SchemaRepository schemaRepository, String statusCode, ApiResponseType apiResponseType)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateResponses(ApiDescription apiDescription, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Let me check, this has still a dep on 5.0.0 and they are at 5.5.0

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 24, 2020

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 24, 2020

I've updated the PR to pin on 1.1.4 until they fix it. It runs now :)

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 24, 2020

Wait a bit with merging @mattfrear, I'm fixing it at the source: microsoft/OpenAPI.NET#492

@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 25, 2020

@mattfrear ready! MS released 1.2.2 with all the breaking changes solved.

@CumpsD CumpsD changed the title upgrade openapi to 1.2.0 (#154) upgrade openapi to 1.2.2 (#154) Jun 25, 2020
@mattfrear mattfrear merged commit 50b1c4b into mattfrear:master Jun 25, 2020
@mattfrear
Copy link
Owner

Nice work David, thanks!

I've released it https://www.nuget.org/packages/Swashbuckle.AspNetCore.Filters/5.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants