Distinct does not work on Enumerable<IEdmStructuredType>

Open
#352 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
api

Research direction

Open src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs at line 197 and inspect how Enumerable values are made distinct. Reproduce the duplicate entity-set case described in the issue and compare entities by FullName rather than instance identity. Done means navigation properties no longer produce duplicate values and the existing test suite passes.

Written by the indexing model from the issue text.

Description

type:bug

https://github.com/microsoft/OpenAPI.NET.OData/blame/c00a26b629e76d624f80911d4b97d9ae86af9cf7/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs#L197 produces duplicates, when there is a navigation property to an entity that is already associate in the entity sets. In our case the EntityType is not the same instance, so it MUST be compared by FullName to get distinct values. I made the same mistake recently, so it would be nice if there is a default comparer.

Dominant language
C#
Stars
240
Forks
70
Avg merge
7h 59m
Merged PRs (30d)
13

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.

More from microsoft/OpenAPI.NET.OData

All issues in microsoft/OpenAPI.NET.OData

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.