You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement IEquatable/ICloneable for all classes in the model hierarchy? #537
I'm having quite some issues with comparing OpenApiSchema objects to other ones.
My workaround for now is to create Extension Methods to compare the hierarchy against another one.
(Which leads to a different set of problems)
What are your thoughts about implenting at least IEquatable<T|OpenApiSchema> for OpenApiSchema to allow this?
Kind regards & thanks for your work
Olli
Edit: Same goes for Cloneable as well.
Edit2: I'm dumb
Edit3: Is there any intention I'm not seeing why this was left out? What I'm seeing, it should be possible to create a generic implementation for equals and clone for the time being.
changed the title [-]Make OpenApiSchema partial or implement IEquatable for all classes in the model hierarchy?[/-][+]Implement IEquatable/ICloneable for all classes in the model hierarchy?[/+]on Dec 14, 2020
This sounds like a great idea to me. ICloneable would be really useful. IEquatable is partially useful. We already have two submissions for comparison capabilities. I want to be really careful about creating even more code to maintain.
Would a comparision capability meet your needs for IEquatable?
I quickly looked through some of the classes, is there any suggested approach of how to implement ICloneable?
For the model I think it should be mostly straight forward, but the Any models (IOpenApiAny) could be a bit trickier.
I will try to create a feat branch today and see how it's going.
We've replaced the OpenApiAny infrastructure with JsonNode from System.Text.Json, this simplifies a lot of things and provides a much better experience.
We've implemented copy (shallow) constructors.
For the remaining aspect, the comparison, there's already an issue tracking this. I'll close this issue as duplicated so we can have a federated conversation over there.
Activity
[-]Make OpenApiSchema partial or implement IEquatable for all classes in the model hierarchy?[/-][+]Implement IEquatable/ICloneable for all classes in the model hierarchy?[/+]darrelmiller commentedon Feb 13, 2021
This sounds like a great idea to me. ICloneable would be really useful. IEquatable is partially useful. We already have two submissions for comparison capabilities. I want to be really careful about creating even more code to maintain.
Would a comparision capability meet your needs for IEquatable?
OlliMartin commentedon Feb 14, 2021
Comparison is totally enough.
I quickly looked through some of the classes, is there any suggested approach of how to implement ICloneable?
For the model I think it should be mostly straight forward, but the Any models (IOpenApiAny) could be a bit trickier.
I will try to create a feat branch today and see how it's going.
darrelmiller commentedon Feb 21, 2021
Ugh, I really don't like those OpenApiAny things. I'll take a look and see if I have any suggestions.
baywet commentedon Dec 22, 2025
A couple of updates: