-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(schemas): Dont panic with non object field kinds #17140
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3ba9721
Dont panic with non object field kinds
StephenWakely 0705a76
Check remap input definition is never
StephenWakely 4123f82
Spelling
StephenWakely 0e86124
Add enrichment tables to the transform outputs
StephenWakely ef60749
Handle remap array outputs
StephenWakely 8ed6528
Return the panics
StephenWakely 55ddb8d
Revert "Return the panics"
StephenWakely bd50d03
Return the panics
StephenWakely 516cb30
Added multiple transform tests
StephenWakely 4ad079f
Mild spacing
StephenWakely 1e7c02b
Mild spacing
StephenWakely a0fd678
Add transport_output_ids to wrap calls to output that don't need defi…
StephenWakely 5e46f19
Test even a VRL error results in the correct ports
StephenWakely 5ec3cfd
Test a mix of array and non array results
StephenWakely 84db500
Error if a returned definition contains never
StephenWakely 252f3a7
Remove never check in transform, the framework should handle it
StephenWakely 68defbf
Feedback from Kyle
StephenWakely 5d7a8b2
Feedback from Kyle
StephenWakely 8eaaa85
Feedback from Spencer
StephenWakely 2e8ac39
Spelling
StephenWakely 8214abc
Feedback from Nathan
StephenWakely 3e0bb2b
Whitespace
StephenWakely f472c07
Only use transform definition fields when schema is enabled
StephenWakely 925f413
Fixed syntax error
StephenWakely dced80a
Clippy
StephenWakely 569994a
Fixed test. Non object top level fields need removing
StephenWakely File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| use async_trait::async_trait; | ||
| use snafu::Snafu; | ||
| use value::Kind; | ||
| use vector_config::configurable_component; | ||
| use vector_core::{ | ||
| config::{DataType, Input, LogNamespace, TransformOutput}, | ||
| schema::Definition, | ||
| transform::Transform, | ||
| }; | ||
|
|
||
| use crate::config::{OutputId, TransformConfig, TransformContext}; | ||
|
|
||
| #[derive(Debug, Snafu)] | ||
| enum Error { | ||
| #[snafu(display("It all went horribly wrong"))] | ||
| ItAllWentHorriblyWrong, | ||
| } | ||
|
|
||
| /// Configuration for the `test_error_definition` transform. | ||
| #[configurable_component(transform("test_error_definition", "Test (error definition)"))] | ||
| #[derive(Clone, Debug, Default)] | ||
| pub struct ErrorDefinitionTransformConfig {} | ||
|
|
||
| impl_generate_config_from_default!(ErrorDefinitionTransformConfig); | ||
|
|
||
| #[async_trait] | ||
| #[typetag::serde(name = "test_error_definition")] | ||
| impl TransformConfig for ErrorDefinitionTransformConfig { | ||
| fn input(&self) -> Input { | ||
| Input::all() | ||
| } | ||
|
|
||
| fn outputs( | ||
| &self, | ||
| _: enrichment::TableRegistry, | ||
| definitions: &[(OutputId, Definition)], | ||
| _: LogNamespace, | ||
| ) -> Vec<TransformOutput> { | ||
| vec![TransformOutput::new( | ||
| DataType::all(), | ||
| definitions | ||
| .iter() | ||
| .map(|(output, definition)| { | ||
| ( | ||
| output.clone(), | ||
| // Return a definition of Kind::never implying that we can never return a value. | ||
| Definition::new_with_default_metadata( | ||
| Kind::never(), | ||
| definition.log_namespaces().clone(), | ||
| ), | ||
| ) | ||
| }) | ||
| .collect(), | ||
| )] | ||
| } | ||
|
|
||
| async fn build(&self, _: &TransformContext) -> crate::Result<Transform> { | ||
| // Even though the definitions returned were `Kind::never`, build needs to be | ||
| // called in order to return the Error. | ||
| Err(Error::ItAllWentHorriblyWrong.into()) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.