You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since it always fail and return the "@jdt.Path" is not a valid attribute for this transformation.
When i try modifying it in a below way. it started working fine.
I changed. from
internal static JdtAttributes GetByName(this IEnumerable<JdtAttributes> collection, string name) { // The default value for the enum is 0, which is None return collection.SingleOrDefault(a => a.FullName().Equals(name)); }
To This
internal static JdtAttributes GetByName(this IEnumerable<JdtAttributes> collection, string name) { // The default value for the enum is 0, which is None return collection.SingleOrDefault(a => a.FullName().ToLower().Contains(name.ToLower())); }
Is it a bug?
The text was updated successfully, but these errors were encountered:
When I was trying to use the JDT by following the https://github.com/Microsoft/json-document-transforms/wiki.
Everytime when i use the @jdt.path in the transformation file, i continuously get the below Exception message
"@jdt.Path" is not a valid attribute for this transformation.
Below is the C# code, I have used by referring the wiki https://github.com/microsoft/json-document-transforms/wiki/Rename-Transformation
`
var engine = new JsonTransformation($"./{specName}");
Source file is
{ "A" : { "RenameThis" : true }, "B" : { "RenameThis" : false }, "C" : [ { "Name" : "C01", "Value" : 1 }, { "Name" : "C02", "Value" : 2 } ] }
Transform file
{ "@jdt.rename" : { "@jdt.Path " : "$[?(@.Rename == true)]", "@jdt.Value" : "Astar" }, "C" : { "@jdt.rename" : { "@jdt.path" : "@[*].Name", "@jdt.value" : "Nstar" } } }
When i try to do it i continuously received the below error.
"@jdt.Path" is not a valid attribute for this transformation.
After all the Trial and error by assuming something wrong with the source or transformation file. I downloaded the source code to find out the reason.
It seems, In JdtRename file. https://github.com/microsoft/json-document-transforms/blob/a9bf106829b3c9d8b73fdf67d37891f95d3f6ee8/src/Microsoft.VisualStudio.Jdt/Processors/Attributes/JdtAttributeValidator.cs Line Number 67. It tries to validate the property name and AttributeNames are equal.
Currently in our case, The property name would be @jdt.path and AttributeNames contains the EnumValues of [Path,Value].
Since it always fail and return the "@jdt.Path" is not a valid attribute for this transformation.
When i try modifying it in a below way. it started working fine.
I changed. from
internal static JdtAttributes GetByName(this IEnumerable<JdtAttributes> collection, string name) { // The default value for the enum is 0, which is None return collection.SingleOrDefault(a => a.FullName().Equals(name)); }
To This
internal static JdtAttributes GetByName(this IEnumerable<JdtAttributes> collection, string name) { // The default value for the enum is 0, which is None return collection.SingleOrDefault(a => a.FullName().ToLower().Contains(name.ToLower())); }
Is it a bug?
The text was updated successfully, but these errors were encountered: