OData / OData/ModelBuilder

How to declare collection of non-nullable references?

Open
#54 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
22
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I use conventional builder to make my model.
Somewhere I have this definition:

    [DataMember]
    public string[]? Codecs { get; set; }

And in metadata it looks like this:

<Property Name="Codecs" Type="Collection(Edm.String)"/>

Which is from my understanding a nullable collection of nullable strings.
I do understand that from a code point of view string is a nullable reference type.
But is there a way to declare that this specific collection contains non-nullable strings?

Contributor guide

Open the contributing guide

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.

Research direction

Start with the CLR Codecs declaration and compare it with the generated Edm.Collection metadata shown in the issue. Trace how the conventional builder determines collection and element nullability, then verify whether a supported declaration can express non-nullable elements. Done means the metadata reflects the intended element nullability or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.