Skip to content

Implement IEquatable/ICloneable for all classes in the model hierarchy? #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
OlliMartin opened this issue Dec 14, 2020 · 3 comments
Open
Labels
type:enhancement Enhancement request targeting an existing experience

Comments

@OlliMartin
Copy link

OlliMartin commented Dec 14, 2020

Hi,

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.

@OlliMartin OlliMartin 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? Dec 14, 2020
@darrelmiller
Copy link
Member

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?

@darrelmiller darrelmiller added the type:enhancement Enhancement request targeting an existing experience label Feb 13, 2021
@OlliMartin
Copy link
Author

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
Copy link
Member

Ugh, I really don't like those OpenApiAny things. I'll take a look and see if I have any suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement request targeting an existing experience
Projects
None yet
Development

No branches or pull requests

2 participants