-
Notifications
You must be signed in to change notification settings - Fork 707
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
Fix versioning error when using composite key #889
Conversation
As much as I appreciate PRs (because they don't come often), I think there is a misunderstanding of this example project. The SomeODataOpenApiExample is meant to highlight how to use OpenAPI with only some OData. Honestly, I struggled to come up with a good name. The reason that composite keys were not working is because not all of the OData features were on or enabled. There are some people out there that want to use vanilla endpoints, but still have OData query capabilities (without an EDM, etc). This means there is no base class or it's likely If you take all of the bits for the I'm happy to continue the discussion, but this PR doesn't appear to fix or enhance anything. |
Thanks for your quick reply! In the ODataOpenApiExample if you comment out the line 20 in Program.cs (options.RouteOptions.EnableKeyInParenthesis = false;) you get the error too (with an entity with composite key). |
Hmm... I tested that out and got a different error. The clue is a NRE that happens due to a I think this definitely is a 🐞 , but I don't think it's specific to composite keys. That was simply a symptom. My observations were as follows: Worksoptions.RouteOptions.EnableKeyInParenthesis = false;
options.RouteOptions.EnableKeyAsSegment = true; Worksoptions.RouteOptions.EnableKeyInParenthesis = true;
options.RouteOptions.EnableKeyAsSegment = false; Fails// this is also the default and same result as if nothing was set
options.RouteOptions.EnableKeyInParenthesis = true;
options.RouteOptions.EnableKeyAsSegment = true; I know that OData is adding different I think it's probably worth opening a new issue that calls out the bug. I don't have a good description yet. I suspect there are scenarios beyond composites keys that will cause this behavior. The only possible workaround at the moment will be to use either parenthesis or as segment for keys, but not both. I'll provide some more details once I've had to dig in a little more. Good find. 😃 |
This was a great find and discussion. Alas, this PR doesn't address the crux of the problem; it's a bit broader. I tracked this with a bit more detail in #891. I've put a new PR which will address this issue and be published with |
I had an error when try to implement a Get action with a model with composite key, whis is the error:
I added a new example project ( SomeODataOpenApiExampleCompositeKey ) to reproduce the error.
In the second commit you can find a possible fix to the issue.
Thanks
Michele