-
Notifications
You must be signed in to change notification settings - Fork 57
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
Xml support #2806
Xml support #2806
Conversation
} else { | ||
xmlMetadata["text"] = true; | ||
} | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lack default
for switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default do nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks so much for your work @tadelesh
if (type.kind === "property" && type.type.kind === "array" && type.type.valueType.kind !== "model") { | ||
const itemMetadata = getXmlMetadata(type.type.valueType); | ||
// if array item is a primitive type, we need to use itemsName to change the name | ||
if (Object.keys(itemMetadata).length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should these just correspond 1-1 with what tsp is returning to us? I.e. xmlMetadata["name"] = itemMetadata["name"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsp only returns the user defined decorator data. xml has some convention that i need to specific handle. so the item related metadata is only for ser/deser in python.
...spec-python/test/azure/generated/authentication-api-key/authentication/apikey/_model_base.py
Outdated
Show resolved
Hide resolved
for _, rf in self._attr_to_rest_field.items(): | ||
prop_meta = getattr(rf, "_xml", {}) | ||
xml_name = prop_meta.get("name", rf._rest_name) | ||
xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not familiar enough with all of this code, but I just want to make sure that we generate everything when we output our generated models. Like how right now we aren't always generating a deserializing callback, even though during generation time we know exactly what the deserializing callback should be. So we can generate xml
stuff all the time, so we don't have to guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current logic for xml does not touch any deserialization mapping in __new__
. so what you want is a common logic both for json and xml. i saw you opened this: #2801. i will work on the optimization after vacation.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.