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

feat(parse_cbor): add parse_cbor function #1152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MiracleWisp
Copy link

@MiracleWisp MiracleWisp commented Nov 28, 2024

Summary

In this PR I would like to add support for cbor. We use this format as an alternative to JSON for more efficient data transfer to Kafka. And we would really like to be able to use vector in our projects

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Unit tests are provided in this PR

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

References

@MiracleWisp MiracleWisp force-pushed the cbor_support branch 6 times, most recently from 8d6a19d to 1ca2e81 Compare November 28, 2024 16:12
@MiracleWisp MiracleWisp changed the title Add cbor support feat(parse_cbor): add parse_cbor function Nov 29, 2024
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MiracleWisp, thank you for your contribution!

| Kind::object(Collection::any())
}

fn type_def() -> TypeDef {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention for this and inner_kind() to be identical to JSON type defs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, cbor uses the same data model as JSON (https://cbor.io/)
I will provide more tests to cover other types besides object and create a PR with documentation to the main vector repository

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation.

TIOLI: we can extract these type defs under a new directory src/stdlib/json_utils.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved type defs to separate module and provided more examples for parse_cbor

@MiracleWisp MiracleWisp force-pushed the cbor_support branch 3 times, most recently from dd269f4 to 4193d5f Compare December 13, 2024 10:12
@@ -0,0 +1,2 @@
[overrides]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall what does this do. Did you run dd-rust-license-tool?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dd-rust-licence-tool fails without this config because "crunchy" package doesn't have repository config in cargo.toml
eira-fransham/crunchy#9

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.

2 participants