-
Notifications
You must be signed in to change notification settings - Fork 62
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
adds support for deprecation #155
Conversation
test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiDeprecationExtensionTests.cs
Show resolved
Hide resolved
test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiDeprecationExtensionTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionOperationHandlerTests.cs
Show resolved
Hide resolved
.../Microsoft.OpenAPI.OData.Reader.Tests/Vocabulary/Capabilities/DeprecatedRevisionTypeTests.cs
Show resolved
Hide resolved
using Microsoft.OpenApi.OData.Vocabulary.Core; | ||
using Xunit; | ||
|
||
namespace Microsoft.OpenApi.OData.Reader.Vocabulary.Capabilities.Tests; |
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.
the namespace looks have different pattern comparing to the existing?
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.
if it were up to me, I'd have converted all the existing files to this new format, you get more real-estate on the screen. But doing so might generate tons of conflicts since we have multiple people contributing at this time.
So my compromise was to do it only for new files, so they are future proof, and maybe later we can have a PR that updates the existing files once we're done with our batch of modifications.
@@ -24,6 +26,12 @@ public class ODataDollarCountSegment : ODataSegment | |||
public override string Identifier => "$count"; | |||
|
|||
/// <inheritdoc /> | |||
public override string GetPathItemName(OpenApiConvertSettings settings, HashSet<string> parameters) => "$count"; | |||
public override IEnumerable<IEdmVocabularyAnnotatable> GetAnnotables() |
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.
alignment the codes, tab -> 4 whitespaces
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.
It seems you can implement the default "GetAnnotables()" at the base class to return an empty Enumerable. Only override the method in the class that should be overridden?
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.
The reason why I didn't make it virtual is because I want the compiler to error out in case we forgot a segment type instead of silently pass. This is going to come handy as we coordinate with PRs that add other segment types. But it could mean a breaking change for people whom inherited from the OData segment class, so I'm willing to compromise on this one. What do you think?
/// <summary> | ||
/// Provides any deprecation information for the segment. | ||
/// </summary> | ||
public OpenApiDeprecationExtension Deprecation { get; set; } |
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.
The deprecation looks for the ODataPath, not a certain Segment in the Path, right?
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.
each segment can have deprecation information, which means a path can have multiple deprecations. Then the path will take the uppermost (shortest path) deprecation.
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.
a good example of that is me/mailFolders/{id}/messages/{id}/attachments
where in theory:
- the user type (or a parent type) could be deprecated
- the me singleton could be depracated
- the mailFolder (or a parent type) could be deprecated
- the mailFolders navigation property could be deprecated
- ...
Assuming we have deprecation for all of those, the deprecation for the path that will be used, is the one from user, if user is not deprecated, the one from me, if not me, mailfolder, etc....
src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiDeprecationExtension.cs
Show resolved
Hide resolved
632b604
to
23c693e
Compare
23c693e
to
1aba9ed
Compare
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
…e deprecation information Signed-off-by: Vincent Biret <[email protected]>
- implements adding deprecration information for all the segment types Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
- updates unit tests following merge Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
1aba9ed
to
f738e9f
Compare
Look good to me. |
fixes #113
This PR sets
deprecated
totrue
on operations that depend on annotables with an annotation of termOrg.OData.Core.V1.Revisions
and of kindOrg.OData.Core.V1.RevisionKind/Deprecated
(see the linked issue for more details).It will also add and extension to the operation to convey the additional information from the annotation like
The flag + extension will be added to any operation if any path segment in the path is annotated including: