Skip to content

OData APIExplorer route template with KeyAsSegment should not quote strings #526

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

Closed
Rob4001 opened this issue Aug 7, 2019 · 2 comments
Closed
Assignees

Comments

@Rob4001
Copy link

Rob4001 commented Aug 7, 2019

Related to #502
Paths being generated for our Swagger docs are including paths such as /API/v1/Resource/'{key}'/SubResource

While the server side routes are /API/v1/Resource/{key}/SubResource

Creating the issue where swagger "try it out" includes the quotes which will be passed to the controller as "'key'".

It looks like the ODataRouteBuilder has the functionality to bypass quotation when KeyAsSegment is set to true but is not passing through to ExpandParameterTemplate when only a single (or first) key

Thanks in advance, really appreciate the library

@commonsensesoftware
Copy link
Collaborator

Doh! Thought I fixed this. Looks like there are a couple of cases where the wrong overload is used. This should be a quick fix.

I've been trying to find a comprehensive breakdown of what the Key As Segment rules are, but I've never found them. Do you happen to know? I've mostly been going off of knowledge of the protocol and occassionally spelunking the OData source code.

Here's things I've been looking for:

  • Are composite keys supported?
    • If so, how? /entity-set/{key1}/{key-n}?
  • Do key segments never use OData URL encoding? (ex: string, GUID, binary, duration, geometry, geography, etc)
  • Do the Key As Segment rules apply to non-entity sets, such as unbound actions or functions?

If you happen to have or know of a sample project that uses this setup, that would be useful too. I feel like every time I've tried to set it up myself it ends up not working as expected. Thanks.

@commonsensesoftware
Copy link
Collaborator

FYI ... the patch for this has been published.

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

No branches or pull requests

2 participants