Skip to content

PostTo Issue #742

Closed
Closed

Description

@strandman

According to built-in-routing-conventions you should be able to Post to Navigation Collection Properties.

But it seems like #573 is hard coded to "CreateRef":
ODataRouteBuilderContext.cs

Valid Post actions on collection navigation properties is also:
PostTo{PropertyName} and PostTo{PropertyName}From{EntityName}

Activity

  1. commonsensesoftware commented on Apr 30, 2021

    @commonsensesoftware
    Collaborator

    Is there actually an issue or you just made an observation?

    It's possible something was missed, but this particular part of route building is not attempting to build the full path. This is looking for the root part of the OData path, which can only be:

    1. An entity set (e.g. collection)
    2. A singleton
    3. An unbounded action or function

    The place where this looks like it might be an issue is inside IsNavigationPropertyLink. It covers {HttpMethod}{PropertyName}, but not {HttpMethod}To{PropertyName}.

    While that is worth fixing, the only scenario I see that would be an issue is that a navigation property could be misinterpreted as an action or function.

    The documentation for OData conventions is useful, but I don't trust it due to painful history lessons. I reference the conventions/templates found directly in the code as the source of truth.

  2. strandman commented on May 5, 2021

    @strandman
    Author

    Is there actually an issue or you just made an observation?
    The place where this looks like it might be an issue is inside IsNavigationPropertyLink. It covers {HttpMethod}{PropertyName}, but not {HttpMethod}To{PropertyName}

    Yes it is an issue because ODataActionDescriptorProvider.cs#L55 removes the ActionDescriptor and It'll not be readded because IsRouteExcluded = ActionType == ODataRouteActionType.Unknown and will never hit ODataRouteBindingInfoConvention.cs#L156. PutTo and PatchTo works simply because ODataRouteBuilderContext.cs#L127 ignores those verbs.

    The documentation for OData conventions is useful, but I don't trust it due to painful history lessons. I reference the conventions/templates found directly in the code as the source of truth.

    Yes I understand, the navigation template you should look at is: NavigationRoutingConvention.cs#L85

    Sorry for bad grammar, I'm not an English speaking person ;)

  3. commonsensesoftware commented on May 5, 2021

    @commonsensesoftware
    Collaborator

    Thanks for the confirmation. It looks like this use case is indeed missed so I'm going to go ahead and mark it as a bug.

  4. added a commit that references this issue on Jun 22, 2021
    575c58d
  5. added 2 commits that reference this issue on Mar 21, 2022
    d918903
    778e451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions