-
Notifications
You must be signed in to change notification settings - Fork 242
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
fix: side effects in tag references #2032
Conversation
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
I'm not sure I agree with this. Tag references are very similar to using $id to reference a Schema, where the target object is implicitly created. I agree that it was a bit of a stretch when $refs could only use locators, but now that we need to support $refs as identifiers, I think there is a strong parallel. |
The previous model results in tons of side effects. A simple example:
Same goes for the description, the tag name etc... |
Quality Gate failedFailed conditions |
Isn't that the expected behaviour? |
From a proxy design pattern, sure. But from a functional point of view, I'd say it's pretty confusing/could lead to nasty production bug since the object model is the same, and the behaviour was different. The message I'm trying to convey here is that we're in control of what properties (or operations) can be proxied, IMHO we should allow reads, and then ask people to go through the Target property for writes. That of course leaves a big question for collections. |
@@ -10,21 +12,24 @@ namespace Microsoft.OpenApi.Models.References | |||
/// <summary> | |||
/// Tag Object Reference | |||
/// </summary> | |||
public class OpenApiTagReference : OpenApiTag | |||
public class OpenApiTagReference : OpenApiTag, IOpenApiReferenceable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to implement IOpenApiReferenceable? None of the other proxy objects do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently it is a bug in every other reference class because the walker expects all references to implement IOpenApiReferencable /cc @MaggieKimani1
Sorry, I was being slow. I agree that editing the reference should not edit the target. I agree with your changes. |
That just means the vacations were good! |
This fixes multiple issues:
We should still break the inheritance, and use a base abstract class as well.