Skip to content

Out of line annotations can't target enum member #1465

Description

@mikepizzo

Validating a schema that has out-of-line annotations targeting an enum member fails.

Assemblies affected

OData .Net lib 7.6-beta.

Reproduce steps

load and validate the following schema:

<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Core.xml">
    <edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
  edmx:Reference>
  <edmx:DataServices>
    <Schema Namespace="my.ns" Alias="myns" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EnumType Name="MyEnum">
        <Member Name="MyMember" Value="0"/>
      EnumType>
      <Annotations Target="myns.MyEnum/MyMember">
        <Annotation Term="Core.Description" String="This is an annotation"/>
      Annotations>
    Schema>
  edmx:DataServices>
edmx:Edmx>

Expected result

Successful validation

Actual result

Error: The property "MyMember" could not be found. Location (12, 10)

Additional detail

IEdmStructuredType type = this.schema.FindType(targetSegments[0]) as IEdmStructuredType;
doesn't handle enumType

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions