microsoft / microsoft/OpenAPI.NET.OData

Distinct does not work on Enumerable<IEdmStructuredType>

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

Nobody has claimed this yet.

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

Description

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.

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

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.