Nswag: Error while generating swagger

Created on 25 May 2017  路  12Comments  路  Source: RicoSuter/NSwag

I was using NSwag to generate swagger files in the following version

NSwag command line tool for .NET 4.6+, toolchain v10.2.6317.32053 (NJsonSchema v8.30.6304.31883) (x64)

However as specified in the issue #655 I have implemented an IOperationProcessor and got the error

System.AggregateException: One or more errors occurred. ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'MyProject.ApiVersionProcessor' does not contain a definition for 'Process'

Then I have updated the NSwag toolkit to latest version

NSwag command line tool for .NET 4.6+, toolchain v10.6.6324.28497 (NJsonSchema v8.33.6323.36213) (x64)
and now I am getting the following error

System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Any suggestion?

bug

Most helpful comment

As of now, the ApiVersionProcessor is integrated into NSwag (see https://github.com/NSwag/NSwag/issues/655) you can remove your version and test again...

All 12 comments

Can you try with the latest CI build?
I worked on the assembly loader and now it looks good for my projects...

https://ci.appveyor.com/project/rsuter/nswag-25x6o/build/artifacts
https://www.myget.org/gallery/nswag-ci

I think that something went wrong because in the NSwag.zip archive there is not the main executable nswag.exe.

Sorry, I removed the reference to nswag.exe in NSwagStudio (the zip archive). Will fix it now...

image

If you still have problems, can you provide a sample output as zip?

Now this problem is solved. However I am still experiencing a problem with the ApiVersionProcessor class.
I have implemented as in #655 and then added the SwaggerOperationProcessor attribute on a controller.

The system compile correctly but I still get

System.AggregateException: One or more errors occurred. ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'MyProject.Common.WebApi.Swagger.ApiVersionProcessor' does not contain a definition for 'Process'

That is correct as my implementation, as in the sample, implements IOperationProcessor that has

public Task<bool> ProcessAsync( OperationProcessorContext context ) {

Should I upgrade NJsonSchema library? Actually I am using

NSwag command line tool for .NET 4.6+, toolchain v11.0.0.0 (NJsonSchema v9.1.4.0) (x64)

As of now, the ApiVersionProcessor is integrated into NSwag (see https://github.com/NSwag/NSwag/issues/655) you can remove your version and test again...

Great! Tested and worked perfectly!
Thanks.

Will this be partof the next release?

Yes, i'm working on v11 (complete migration to .NET Standard, bug fixes, some enhancements)... I hope to release soon, but i have to do more integration tests. If possible, please verify if everything works as expected.

Join https://gitter.im/NSwag/NSwag for the release announcements, etc...

Was this page helpful?
0 / 5 - 0 ratings