OData / OData/AspNetCoreOData

Optional parameters is required (path) after bumping

Open
#1,132 3 comments 0 reactions 1 assignee View on GitHub

@habbes is already working on this.

Since Dec 20, 2023.

follow-up investigating
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Assemblies affected

    <PackageReference Include="Microsoft.AspNetCore.OData" Version="8.0.11" />
    <PackageReference Include="Asp.Versioning.OData" Version="7.1.0" />
    <PackageReference Include="Asp.Versioning.OData.ApiExplorer" Version="7.1.0" />

Describe the bug
Before bumping version optional function parameter was passed as query but is not in path.

Data Model

var subscription = builder.EntityType<CloudServiceSubscriptionDto>().HasKey(x => x.Key);
subscription.Abstract();
subscription.Function("Networks").ReturnsCollection<Network>().Parameter<string>("location").Optional();

EDM (CSDL) Model

<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="UIPath.Hypervisor">
<EntityType Name="CloudServiceSubscription" Abstract="true">
<Key>
<PropertyRef Name="key"/>
</Key>
<Property Name="key" Type="Edm.Guid" Nullable="false"/>
<Property Name="name" Type="Edm.String" Nullable="false"/>
<Property Name="description" Type="Edm.String"/>
<Property Name="insertedDateTime" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="updatedDateTime" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType>
<ComplexType Name="Network">
<Property Name="subnets" Type="Collection(UIPath.Hypervisor.Subnet)" Nullable="false"/>
<Property Name="id" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="location" Type="Edm.String"/>
</ComplexType>
<EntityType Name="AzureSubscription" BaseType="UIPath.Hypervisor.CloudServiceSubscription">
<Property Name="subscriptionId" Type="Edm.String" Nullable="false"/>
<Property Name="clientId" Type="Edm.String" Nullable="false"/>
<Property Name="tenantId" Type="Edm.String" Nullable="false"/>
</EntityType>
<EntityType Name="AWSSubscription" BaseType="UIPath.Hypervisor.CloudServiceSubscription">
<Property Name="accessKey" Type="Edm.String" Nullable="false"/>
</EntityType>
<EntityType Name="GCPSubscription" BaseType="UIPath.Hypervisor.CloudServiceSubscription">
<Property Name="projectId" Type="Edm.String" Nullable="false"/>
</EntityType>
<ComplexType Name="AzureSubscriptionEditOrAddRequest">
<Property Name="subscriptionId" Type="Edm.String"/>
<Property Name="tenantId" Type="Edm.String"/>
<Property Name="clientId" Type="Edm.String"/>
<Property Name="clientSecret" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="AWSSubscriptionEditOrAddRequest">
<Property Name="accessKey" Type="Edm.String"/>
<Property Name="secretKey" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="GCPSubscriptionEditOrAddRequest">
<Property Name="projectId" Type="Edm.String"/>
<Property Name="privateKey" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</ComplexType>
<Function Name="Networks" IsBound="true">
<Parameter Name="bindingParameter" Type="UIPath.Hypervisor.CloudServiceSubscription"/>
<Parameter Name="location" Type="Edm.String">
<Annotation Term="Org.OData.Core.V1.OptionalParameter"/>
</Parameter>
<ReturnType Type="Collection(UIPath.Hypervisor.Network)"/>
</Function>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Expected behavior
Function parameters can be passed as query

Screenshots
Before bumping
image
After bumping
image

See that location was in query before

Bonus question

why $select is now select?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.