-
Notifications
You must be signed in to change notification settings - Fork 58
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
Gyoku.xml produces wrong results with arrays of hashes #48
Comments
Hey @dredozubov I think in your example the output for the given input should be
In general, I agree with you that Did you file this issue because you're trying to pass an array of hashes as parameters to an operation with Savon? A little more context would help me better understand your problem. Changing this behavior would certainly break tests in Gyoku, and probably implicitly break Savon users (which would be a Bad Thing™ indeed). Also, I'm pretty sure this is unrelated to #40 -- that bug is just stating that calling |
@tjarratt yeah, you're right about my example, i was typing it and, whatever, you get the point. Yeah, we were building structurally similar query with savon(v2). This behaviour is obviously wrong and weird for tree-like structures, such as xml. It rendered gyoku _absolutely useless_ to us(we were going to use it with small queries) and we just globally switch to Changing this behaviour should break the tests. It's really hard to imagine why this behaviour could be needed at all. I believe it should be done(as a major version bump, to maintain semantic versioning) and Savon should manage with explicit gemspec dependencies and probably switch to new version with Savon 3 release. |
Cool, thanks for enlightening me! I totally agree that a major version bump is in order. Unsure when I'll have time to make this change, possibly later this week? If you're interested, I'd be more than happy to merge a pull request for this behavior. I think you have a really good idea of what it should do, and I agree completely that outside of the context of Savon, this is pretty crazy and wrong. |
@tjarrat we also have run smack up against this Gyoku behavior, which we definitely consider undesireable. Just like @dredozubov, we are trying to serialize a hash element that is an array, and finding the key for the entire array wrapped around each element. On the plus side, finding this issue has relieved us of the need to flail about trying to figure out what we were doing wrong. A fix soon would be deeply appreciated. |
@tjarratt I think i'll try to look into it later this week and submit a PR. Time is an issue, but i think i will manage. |
@tjarratt I gave it a quick look and gyoku has quite a lot of quirks. It is somewhat painful to preserve the rest of this complex array behaviour and do this kind of change.
I'm not quite sure we're on the same page on that. Let's talk it out first. :) It's quite silly to expect It elevates other problems to the surface though. I get a very inconsistent feel from current behaviour with arrays and i get even more discouraged, when i see things like this #37 is ridiculous IMO. Why do this tags should be named 'element', what is a nested array in the xml tree?) merged recently. Why do we have stuff like that? Xml is a tree-like structure and we should treat it as such on API level. I'd gladly proposed to drop support of all input data structures except Arrays of hashes in Would like to know what you think. Peace. ✌️ |
It produces:
I think this behaviour is completely incorrect. I believe it should return:
<foo><bar>1</bar><bar>2</bar><bar>3</bar></foo>
.I haven't got time to look it yet, but It may be related to #40
The text was updated successfully, but these errors were encountered: