Skip to content
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

Fix proposal for parse_xml in case of unique child: #849

Merged

Conversation

ScriptToddler
Copy link
Contributor

@ScriptToddler ScriptToddler commented May 20, 2024

  • Modify single node map insert behaviour -> process_node instead of recurse
  • Add tests for unique child situation

Related to #844

@pront
Copy link
Collaborator

pront commented May 21, 2024

Hi @ScriptToddler, thank you for this PR! Can you add a test case that demonstrates the bug this PR fixes?

@pront
Copy link
Collaborator

pront commented May 21, 2024

Also, this will need a changelog fragment, is this a breaking change?

@jszwedko
Copy link
Member

Also, this will need a changelog fragment, is this a breaking change?

It is breaking in that it changes the result but I think it is a bug since I'm not sure who would want the old behavior so can just be marked as a fix.

@jszwedko
Copy link
Member

jszwedko commented Jun 6, 2024

Small bump on this @ScriptToddler . Just wondering what you think of the above.

- Modify single node map insert behaviour -> process_node instead of recurse
- Add tests for unique child situation
@ScriptToddler ScriptToddler force-pushed the fix/parse_xml_unique_child_text branch from 99a7a2e to af7963f Compare June 8, 2024 11:58
@ScriptToddler
Copy link
Contributor Author

Small bump on this @ScriptToddler . Just wondering what you think of the above.

Hi,

@jszwedko On my part, I consider it should be a fix, as you said.

@pront As for the tests, I did include two new unit tests in the parse_xml.rs file : if_no_sibling and if_no_sibling2, demonstrating that it seems to now work as intended, not adding the unwanted "text" keys. If that does not suffice, I'm not sure what is expected then.

Finally, I must confess I mostly wanted to point out the problem and offer what appeared to me a quick win fix. For my needs, I have found a workaround so I'm not bothered anymore by this behaviour, and I don't intend to spend more time on this. If this PR does not meet your requirements, it can be thrown away, no problem on my part.

Regards,

@ScriptToddler
Copy link
Contributor Author

ScriptToddler commented Jun 8, 2024

Hi again,

Adding to my previous comment, I just realized my branch is now conflicting since commit ef07d02 introduced a refactoring of the function with the logic now in a separate crate of parsing functions. So basically the proposed change should now be applied to that new file https://github.com/vectordotdev/vrl/blob/main/src/parsing/xml.rs#L174

Regards

@pront pront marked this pull request as draft June 10, 2024 13:34
@pront
Copy link
Collaborator

pront commented Jun 10, 2024

Hi @ScriptToddler, thanks again for raising this issue and for submitting a fix. If you don't intend to spend more time on this PR, no worries at all. Leaving it open as a draft for someone else to take over.

@pront pront requested a review from jszwedko September 13, 2024 16:59
@pront pront marked this pull request as ready for review September 13, 2024 16:59
@pront
Copy link
Collaborator

pront commented Sep 13, 2024

I applied the fix to the latest main and added a changelog.

@pront pront added this pull request to the merge queue Sep 13, 2024
Merged via the queue into vectordotdev:main with commit 3ca9f6c Sep 13, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants