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

The ConstantNode from CollectionConstantNode returns type full name in LiteralText property #2607

Closed
SamGuoMsft opened this issue Jan 26, 2023 · 1 comment · Fixed by #2609

Comments

@SamGuoMsft
Copy link

@xuzhg , as we discussed, The ConstantNode from CollectionConstantNode returns type full name in LiteralText property.
Here is the snapshot:
image

Assemblies affected

Which assemblies and versions are known to be affected e.g. OData .Net lib 7.x

Reproduce steps

The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue.

Expected result

What would happen if there wasn't a bug.

Actual result

What is actually happening.

Additional detail

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

@xuzhg
Copy link
Member

xuzhg commented Jan 26, 2023

@SamGuoMsft The problem is from this line code:

https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/UriParser/SemanticAst/CollectionConstantNode.cs#L57

It calls ToString for the item and takes that as literal. we don't overwrite ODataEnumValue.ToString(), so it outputs the type name.

The fix could be:

  1. Not set the literal for the item. Keep it as null, (Because you can get the collection literal, each item literal is included in the collection literal)

  2. Call convert the item into the URI literal. we can call 'ConvertToUriLiteral, but we don't have the model in the CollectionConstantNode constructor. It only works for primitive values.

  3. or simply override ToString for ODataEnumValue or other OData value classes. It only fixes parts and this output could be not the same as the original literal.

Let me draft the fix based on # 3.

xuzhg added a commit that referenced this issue Jan 26, 2023
xuzhg added a commit that referenced this issue Feb 1, 2023
…e full name in LiteralText property (#2609)

* fixes #2607: The ConstantNode from CollectionConstantNode returns type full name in LiteralText property

* update the base line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants