Closed urbanspr1nter closed 4 years ago
The FlatteningSerializer used in the Azure SDK serializes the "@odata.type" annotation as
{
"@odata": {
"type": "#Microsoft.Whatever"
}
}
instead of
{
"@odata.type": "#Microsoft.Whatever"
}
This is a bug in FlatteningSerializer, and can be fixed with the following patch:
diff --git a/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningSerializer.java b/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningSerializer.java
index 3b11f0a79..b83c8ff66 100644
--- a/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningSerializer.java
+++ b/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningSerializer.java
@@ -177,13 +177,14 @@ public class FlatteningSerializer extends StdSerializer<Object> implements Resol
ObjectNode node = resCurrent;
String key = field.getKey();
JsonNode outNode = resCurrent.get(key);
+
if (key.matches(".*[^\\\\]\\\\..+")) {
// Handle escaped map key
//
String originalKey = key.replaceAll("\\\\.", ".");
resCurrent.remove(key);
resCurrent.put(originalKey, outNode);
- } else if (key.matches(".+[^\\\\]\\..+")) {
+ } else if (key.matches(".+[^\\\\]\\..+") && !key.equals("@odata.type") ) {
// Handle flattening properties
//
String[] values = key.split("((?<!\\\\))\\.");
I don't know if this is the right fix though, as it seems... hacky.
@yungezz can you help route this?
hi @yaohaizh could you pls take care of this java sdk generation issue?
hi @xccc-msft could you pls have a look?
@urbanspr1nter Are you still facing same issue? I just tried with v2018_07_01. It looks the serialize issue has been fixed. I'm able to get below:
{"properties":{"outputs":[{"preset":{"presetName":"AdaptiveStreaming","@odata.type":"#Microsoft.Media.BuiltInStandardEncoderPreset"}}]}}
close the issue now since SDK with specific API version released already. feel free to create new issue if any other ask.
I am trying to create a Transform workflow and am getting an error while trying to invoke the call to create my Transform entity.
The error is complaining about not recognizing the property
presetName
... I have tried this both in the v2018_03_30 and v2018_06_01 API ... and am not finding luck :(Here is how I am creating my transform entity:
Looking at the code, it looks like the property is being defined correctly by the code generator, but is not passing validation upstream.
In addition, here is the request body: