Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Import vocabulary annotations declared in external referenced models #1987
Import vocabulary annotations declared in external referenced models #1987
Changes from 6 commits
36af6c3
256e3b1
26a681e
d6087fc
9613de6
a3a8877
b838022
717346e
6ed8841
747511b
e4279cf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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.
Document this param and the following 2
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.
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.
Maybe apply the constructor that takes an
IEqualityComparer<T>
argument ifTermNamespace="Org.OData.Capabilities.V1"
is considered to be equivalent toTermNamespace="org.OData.Capabilities.V1"
(i.e. case-insensitive)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.
I believe namespaces are case-sensitive. At least in many cases, the spec mentions that identifiers are case-sensitive. I assume it applies to namespaces as well.
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.
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.
@habbes RE: If it's null, all annotations will be added unconditionally
Does this happen from the calling method or this (
AddOutOfLineAnnotationsFromSchema
) method?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.
That actually takes place in the
FilterIncludedAnnotations
method, which is called by this method (AddOutOfLineAnnotationsFromSchema
). TheFilterIncludedAnnotations
method has a similar note in its doc comments.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.
Is this ever likely to evaluate to
true
given the initialization ofincludeAnnotationsIndex
here? Maybe check fornull
and empty (or just empty ifnull
is unlikely)?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's actually set to null when called from the original
AddSchema(schema, addAnnotations)
method here.In that method, when the
addAnnotations
was set true, all the annotations in the schema were added without any filtering. In that case I call theAddSchemaOutOfLineAnnotations
withincludeAnnotationsIndex
set tonull
to indicate that all annotations should be added without any filtering. If, on the other hand, theincludeAnnotationsIndex
is empty, then all annotations will be filtered out and not get added, since theShouldIncludeAnnotation
method will return false.I think I should mention in the doc comments what the intended behaviour is when
includeAnnotationsIndex
isnull
.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.
I think I should make an optimization to avoid filtering the annotations if the
includeAnnotationsIndex
is empty, since in that case none of the csdl annotations will be imported.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.
should this use csdlAnnotations.Target, or "target" (which has the alias already resolved)?
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 aim here is to return a copy of the
CsdlAnnotations
instance but with the actual annotations filtered. So every other property should be identical to the originalCsdlAnnotations
instance, hencecsdlAnnotations.Target
. Thetarget
with the alias already resolved is used when comparing against theinclude.TargetNamespace
.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.
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.
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.
Just to confirm
annotation.Qualifier == include.Qualifier
andtargetNamespace == include.TargetNamespace
will be a case-sensitive comparison...Maybe
?
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.
I believe they are case sensitive
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.
Indeed: Names are case-sensitive, but service authors SHOULD NOT choose names that differ only in case.