Skip to content

Need for parsing Open types using OData.NET v7.X  #800

Description

@ysanghi

Short summary (3-5 sentences) describing the issue.
For primitive and complex types both OData v7 just provides a raw JSON. Parsing this is more complicated since, now the consumers have to understand what are annotations vs properties during read parsing and then consumers of the OData lib have to come up with writers can produce valid JSON that is again compatible and looks like OData JSON when they have to output untyped complex properties. The ask here is to have support for readers and writers to be able to handle complex “Untyped” complex properties in manner that will make it easier for the consumer to work with them without having to write their own reader/parsers/writers.

Assemblies affected

OData.NET v7.X

Reproduce steps

Try out post/writing a untyped property

Expected result

During read: OData parsers would provide some hint saying that the property is dynamic but at the same time provide a performance efficient way to get to the parsed value and not just provide a raw string.

During write: OData writer would take hints that it's writing an dynamic property but then still allow writing back primitive and complex dynamic properties, without asking the consumers to convert the complex types to raw json strings.

Actual result

"message":"No TypeName was found for an ODataResource of an open property, ODataResource or custom instance annotation, even though metadata was specified. If a model is passed to the writer, each complex value on an open property, resource or custom instance annotation must have a type name."
"innererror":{"message":"No TypeName was found for an ODataResource of an open property, ODataResource or custom instance annotation, even though metadata was specified. If a model is passed to the writer, each complex value on an open property, resource or custom instance annotation must have a type name.","type":"Microsoft.OData.ODataException","stacktrace":" at Microsoft.OData.TypeNameOracle.ResolveAndValidateTypeName(IEdmModel model, String typeName, EdmTypeKind expectedTypeKind, Nullable`1 expectStructuredType, IWriterValidator writerValidator)
at Microsoft.OData.TypeNameOracle.ResolveAndValidateTypeFromTypeName(IEdmModel model, IEdmStructuredType expectedType, String typeName, IWriterValidator writerValidator)
at Microsoft.OData.ODataWriterCore.PromoteNestedResourceInfoScope(ODataItem content)
at Microsoft.OData.ODataWriterCore.CheckForNestedResourceInfoWithContent(ODataPayloadKind contentPayloadKind, ODataItem contentPayload)
at Microsoft.OData.ODataWriterCore.WriteStartResourceImplementation(ODataResource resource)

Additional details

Optional, details of the root cause if known. Delete this section if you have no additional details to add.

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions