Skip to content
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

Add support for Singleton's in VocabularyAnnotationInaccessibleTarget Rule. #2054

Closed
marabooy opened this issue Apr 19, 2021 · 0 comments · Fixed by #2055
Closed

Add support for Singleton's in VocabularyAnnotationInaccessibleTarget Rule. #2054

marabooy opened this issue Apr 19, 2021 · 0 comments · Fixed by #2055
Assignees

Comments

@marabooy
Copy link
Member

Short summary (3-5 sentences) describing the issue.

Currently adding a new out of line annotation for singletons causes the VocabularyAnnotationInaccessibleTarget rule to fail. According to the OData spec singletons are uniquely identified and shoulc be able to be addressed using a unique target consutructed using the rule MySchema.MyEntityContainer/MySingleton

Assemblies affected

Assemblies affected 7.*

Reproduce steps

  var model = CsdlReader.Parse(XmlReader.Create(@"C:\dev\Example.csdl"));
            model.Validate(out var errors);
            foreach (EdmError error in errors)
            {
                Console.WriteLine(error.ErrorMessage + error.ErrorLocation);
            }
         

Using the following csdl

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
    <edmx:DataServices>
        <Schema Namespace="Example" xmlns="http://docs.oasis-open.org/odata/ns/edm">
            <EntityType Name="Person" OpenType="true">
                <Key>
                    <PropertyRef Name="UserName" />
                </Key>
                <Property Name="UserName" Type="Edm.String" Nullable="false">
                </Property>
                <Property Name="FirstName" Type="Edm.String" Nullable="false" />
            </EntityType>
            <EntityContainer Name="DefaultContainer">
                <Singleton Name="Me" Type="Example.Person">
                </Singleton>
            </EntityContainer>
            <Annotations Target="Example.DefaultContainer/Me">
                <Annotation Term="Org.OData.Core.V1.Description" String="Represents self."/>
            </Annotations>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

Expected result

No errors are produced.

Actual result

The entity set 'Me' could not be found.(18, 18)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant