AspNetCoreOData
AspNetCoreOData copied to clipboard
Visual Studio Connected Services don't work with OpenAPI generated with ASP.NET Core OData
Assemblies affected ASP.NET Core OData 8.x
Describe the bug The client code generated with the Visual Studio Connected Services cannot be build due to errors with /$count segment
Reproduce steps You can reproduce it on your ODataRoutingSample:
- Launch it.
- Create Console application in the other instance of Visual Studio.
- On the created project: Add -> Connected Service -> Add a service reference -> Open API
- Specify http://localhost:64771/swagger/v1/swagger.json as an URL
- Click Finish
- Try to build the application
You will get a lot of build errors. The problem is in the $count sergment which produces $ in the function names (e.g. V1_Companies_$countAsync())
~/Customers ~/Customers/$count
are the correct url in OData.
We should check $ is correct symbol in Open API?
@vladimirlashko I test it. It seems the Open API Connect Service generates the proxy classes directly using the path item string.
So, There are some problems:
- /$count, $ref $metadata, $batch are OData key segments, but it can't be used to generate the C# method name.
- We have a lot of path templates, for example, the key template {key} or function parameter template, for example, param={param}, the code generated can't handle them correctly.
So, Can you file or transfer this to the connect service open API repo?
Thank you for the detailed answer. My colleague have made the following NSwag issue - https://github.com/RicoSuter/NSwag/issues/3976 Did you mean this repo? Or we should find VS Connected Services repo?
Or we should find VS Connected Services repo?
If you find that, let us know @vladimirlashko .... I don't think such repo exists. I have a few requests to make to them myself if it does however 😅