OData / OData/AspNetCoreOData

Annotation to handle sanitization of field names in open types

Open
#1,269 4 comments 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Jun 25, 2024.

feature followup
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Assemblies affected
ASP.NET Core OData 8.x

Describe the bug
There is no way to handle special characters if present in dynamic properties in OData, causing:

"The property name '01.01' is invalid; property names must not contain any of the reserved characters ':', '.', '@'."

Reproduce steps
in an IDictionary<string, object>, if the key contains a special character, on read it throws this error

Data Model

class Test {
        public string Id{ get; set; }


        //extradata
        public IDictionary<string, object> ExtraData { get; set; }
}

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="RY.Models">
<EntityType Name="Test" OpenType="true">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Id" Type="Edm.String" Nullable="false"/>
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Request/Response
N/A

Expected behavior
There needs to be, for the open type annotation, a way to specify that non-compliant field names must be sanitized before sending them out.

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.