Repository navigation
Add annotation term for Org.OData.Community.UrlEscape.V1.UrlEscapeFunction. - #1307
Conversation
7dd5ebd to
c85867d
Compare
|
|
There was a problem hiding this comment.
The name space and the alias should be better, not only for the "UrlEscape". I think we will add more into this schema for more community terms. Check with @mikepizzo for better naming. #Closed
There was a problem hiding this comment.
As we discussed, I have moved the UrlEscapeFunction term into a new CommunityVocabularies.xml, keeping existing AlternativeKeysVocabularies.xml unchanged (will be deprecated later). #Closed
There was a problem hiding this comment.
Resolved: have updated namespace and alias to community.
In reply to: 229003178 [](ancestors = 229003178)
| /// Parse Alternate Keys Vocabulary Model from CommunityVocabularies.xml | ||
| /// | ||
| static AlternateKeysVocabularyModel() | ||
| { |
There was a problem hiding this comment.
From the C# spec:
A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
I am wondering about the order of execution about the static field "Instance" and the static constructor. For example:
If I access the "AlternateKeysVocabularyModel.Instance", before any code, what will happen?
If static constructor executed before field access, "Instance" is a null reference.
Maybe I am wrong, please make sure the calling is in correct order.
#Resolved
There was a problem hiding this comment.
As we checked off line, the AlternateKeysVocabularyModel.Instance could be a null reference depends on initialization order of static intances / fields. But when it is null, it will be initialized first before it's used. So the static field should not be null when it is used. #Resolved
|
/// |
||
| /// Representing Url Escape Vocabulary Model. | ||
| /// | ||
| public static class UrlEscapeVocabularyModel |
There was a problem hiding this comment.
Maybe it's better in a new file. #Closed
|
|
||
| static UrlEscapeVocabularyModel() | ||
| { | ||
| UrlEscapeFunctionTerm = Instance.FindDeclaredTerm(UrlEscapeVocabularyConstants.UrlEscapeFunction); |
There was a problem hiding this comment.
Same as the execution of the order. #Resolved
| StringWriter swAlternateKeys = new StringWriter(); | ||
|
IEnumerable |
||
| using (var xw = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true, Encoding = Encoding.UTF8 })) | ||
| using (var xwAlternateKeys = XmlWriter.Create(swAlternateKeys, new XmlWriterSettings { Indent = true, Encoding = Encoding.UTF8 })) |
|
|
||
| string output = swUrlEscape.ToString(); | ||
| Assert.True(expectedUrlEscape == output, $"expectedUrlEscape not matching"); | ||
|
|
| } | ||
|
|
||
| [Fact] | ||
| public void TestUrlEscapeVocabularyModel() |
There was a problem hiding this comment.
Add test cases in:
- Create Edm function with the "urlEscape" annotation and can write it to CSDL ((inline and outline)
- Can reader the CSDL with the Edm function decorated with "UrlEscape" annotation, (inline and outline)
| @@ -1,5 +1,5 @@ | |||
| //--------------------------------------------------------------------- | |||
|
// |
|||
There was a problem hiding this comment.
Maybe it's better to "[Obsolete]" for the existing "AlternateKeys*" classes and files.
Meantime, to create new for "Community*" classes and files?
c85867d to
30bfbd2
Compare
|
@xuzhg @mikepizzo I have created a new CommunityVocabularies.xml to contain the UrlEscapeFunction term in the commit above. Can you please take a look? #Resolved |
85ab2a5 to
91e371f
Compare
- Move the UrlEscapeFuntion into new Community vocabularies; AlternateKeys will be moved later.
91e371f to
4783300
Compare
| namespace Microsoft.OData.Edm.Vocabularies.Community.V1 | ||
| { | ||
|
/// |
||
| /// Representing Url Escape Vocabulary Model. |
There was a problem hiding this comment.
Url Escape [](start = 21, length = 10)
it should be "Community" #Closed
There was a problem hiding this comment.
fixed. #Closed
| private readonly IEdmModel model = CommunityVocabularyModel.Instance; | ||
|
|
||
| [Fact] | ||
| public void TestCommunitySchemaModel() |
There was a problem hiding this comment.
Schema [](start = 33, length = 6)
TestCommunityVocabularyModel ? #Resolved
There was a problem hiding this comment.
updated. #Resolved
|
|
||
| namespace Microsoft.OData.Edm.Tests.Vocabularies | ||
| { | ||
| public class CommunityVocabularyTests |
There was a problem hiding this comment.
CommunityVocabularyTests [](start = 17, length = 24)
Maybe add test cases:
-
In the CsdlWriter, create the model with function decorated with this term?
-
In the CsdlReader, read the csdl with function decorated with this term. #Resolved
There was a problem hiding this comment.
Yes these tests will be added, as part of EDM model validation test along with bound function, in the task for upper layer and as a separate PR. This PR here is just to add the CommunityVocabulary. #Resolved
|
The vocabulary and related codes looks good to me. Biao said he will add more test cases when he implements the validation rules. So, I approved it. In reply to: 434092366 [](ancestors = 434092366) |
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
converting [](start = 77, length = 11)
The function doesn't do the conversion; maybe "Annotates a function to be substituted for a colon-escaped segment in a Url path." #Closed
| public static class CommunityVocabularyConstants | ||
| { | ||
|
/// |
||
| internal const string UrlEscapeFunction = "Org.OData.Community.V1.UrlEscapeFunction"; |
There was a problem hiding this comment.
internal [](start = 8, length = 8)
Either make this public or make the class internal. Unless we think there is a client scenario that requires it, I would make the class internal -- we can always make it public later. #Closed
There was a problem hiding this comment.
571f620 to
16e3908
Compare
16e3908 to
00d649e
Compare
|
@mikepizzo and @xuzhg: Thanks for the CR! I will add additional terms per incoming requests. |
…on. (OData#1307) * Add annotation term for OData.Community.UrlEscape.V1.UrlEscapeFunction. - Move the UrlEscapeFuntion into new Community vocabularies; AlternateKeys will be moved later. * Update per CR comments. * CR updates from Mike's comments.
…on. (#1307) * Add annotation term for OData.Community.UrlEscape.V1.UrlEscapeFunction. - Move the UrlEscapeFuntion into new Community vocabularies; AlternateKeys will be moved later. * Update per CR comments. * CR updates from Mike's comments.
Issues
This pull request is to add OData.Community.UrlEscape.V1.UrlEscapeFunction annotation, so that it is available for use in URI parsing (pending).
Description
Refactor community annotation schema with the additional schema ns "OData.Community.UrlEscape.V1".
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.