-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-http] use # as the charkey in xml parsers #9599
Conversation
/azp run js - storage-blob - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run js - storage-file-share - tests |
/azp run js - storage-queue - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run js - servicebus - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run js - storage-blob - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run js - servicebus - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Technically this is a breaking change in core-http, although I don't think there are any libraries except storage and service bus depending on xml parser. |
/** | ||
* Key that is used to access the XML value content. | ||
*/ | ||
export const XML_CHARKEY = "#"; |
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 have newline at EOF
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.
Provisionally, I'm fine with this change, but I'm curious if/how it will affect consumer code.
Does it mean someone will have to change the property name they're accessing in their code?
consumer of our libraries or consumer of core-http? It shouldn't affect the former. For latter if there are any other direct consumers (I doubt) than storage/service bus, they would need changes similar to those storage/SB in this PR. |
But if Storage/SB need updates to work with this version of core, would it mean a major version bump of core-http so that folks on older storage/SB don't get broken? |
My understanding is it's internal in the core-http SB related to how xml is parsed to JSON. '$' would be the JSON property key referring to xml element attribute and '_' the key of element value initially then they were deserialized to object that don't have these keys. |
I will do some testing. There might be scenario in storage where previously '#' was passing in via some parameters. |
We were using '_' as charkey, which is the prrefix that is used to access the character content of xml elements. It caused issues like switch to use '#' as the charkey. '#' is an invalid character for blob metadata key names so it is safe to use.
afb9d66
to
c271876
Compare
Yes it's a breaking change. Older versions of Service Bus won't work after this. Storage should be fine as they don't use the CHARKEY/ATTRKEY directly. Are we ready for major bump? |
If it's a breaking change, should we wait on this and make it part of |
Yes I think it's better to do this in core-xml. The issue is that storage explorer/storage cannot list blobs whose metadata key-value pair has |
@xirzec I've been thinking about allowing Storage to customize CHARKEY in the options to |
That sounds like a great way to avoid breaking backwards compatibility. I do a similar thing in |
I tried two approaches
|
I'm not sure if |
@xirzec |
Yes, my point was that For Am I missing something here? |
You are right. I can use |
Closing this. Will create another PR of passing xmlCharKey option. |
We were using '_' as charkey in xml2js parser settings. It is the key used to
access the value content of xml elements. This caused issues like
#9171 where '_' cannot be used as a blob metadata key. The fix is
switching to use '#' as the charkey. '#' is an invalid character for
blob metadata key names and for identifer names in most programming
languages so it should be safe to use.
Consumers of our libraries are not impacted as this key is only used internally in core-http/Service Bus.