-
Notifications
You must be signed in to change notification settings - Fork 711
OData template should not be quoting key segments #502
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
Comments
Interesting... I could swear that it was required, even when you use attributes to define the route template. It's entirely possible I'm wrong or things have changed. The basis for the OData URL template building code is from work I used for the old Web API Help Pages 6+ years ago. Sadly, the OData team has never put forth anything closely resembling an API Explorer. If no quotes are required, that actually makes things much simpler so I'm happy to take it out. I'll tweak the examples and give it a go just to confirm. I'm assuming you're right, in which case I'll add the removal of the quotes in to the current change set I'm working on. I've already fixed some of the URL generation, but I know Thanks for pointing this out. |
Interesting.... @hippiehunter, it looks like the issue is an incongruence between intrinsic OData route templates and OData URL construction for the API Explorer. In terms of OData route templates, you are correct - quotes aren't needed and are handled by the OData parser; however, the inverse is not true. The API Explorer does need to include the quotes because the OData libraries are not involved and tools like Swagger or any other client will not know or otherwise understand to add the quotes. The current implementation builds and uses the same generation process for both the server and client side OData templates. Clearly, there are ever-so-slightly different nuances between the two. I'll have to do some refactoring so that the server-side doesn't do this, but the client-side for the API Explorer does. |
in src\Common.OData.ApiExplorer\AspNet.OData\Routing\ODataRouteBuilder.cs : ODataRouteBuilder.ExpandParameterTemplate there is code to handle quoting certain data types but that only makes sense when generating a url. OData templates don't put quotes around the parameter. Ive attempted to follow back the references to this function and I don't seen any obvious uses of it where it should be quoting the parameter names.
Surrounding the parameter template with quotes causes an ODataException to be thrown when the template is parsed later on.
see @KanishManuja-MS reply OData/WebApi#1791
The text was updated successfully, but these errors were encountered: