Skip to content

Conversation

teresaromero
Copy link

Fix #2832

The way to reproduce this bug is then the package has a spec version lower than 3.2.
Subobjects support was included after 3.2 so having this spec under the data-stream manifest in a package with lower version does not recognize the property of the data-stream manifest

Solution proposed is to skip the question for subobjects when a package spec version is under 3.2. The default value (false) should not be written at the manifest of data-stream

@teresaromero teresaromero marked this pull request as ready for review September 15, 2025 13:16
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Looks good 🎉 Added a couple of suggestions.

@@ -183,14 +193,14 @@ func createDataStreamCommandAction(cmd *cobra.Command, args []string) error {
return nil
}

func createDataStreamDescriptorFromAnswers(answers newDataStreamAnswers, packageRoot string) archetype.DataStreamDescriptor {
func createDataStreamDescriptorFromAnswers(answers newDataStreamAnswers, packageRoot string, specVersion *semver.Version) archetype.DataStreamDescriptor {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could unit test this function, checking the manifest it generates for given answers.

Further testing could be added to internal/packages/archetype/data_stream_test.go, but we wouldn't be really testing if the behaviour changes for the format version used in the package.

Copy link
Author

Choose a reason for hiding this comment

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

I've added some unit testing as suggested, also for the survey questions i've encapsulated this logic to at least check that the question is added or not based on the version.

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Looks great!
Just added some comments in tests to avoid possible errors.

teresaromero and others added 7 commits September 16, 2025 13:52
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 16, 2025

💔 Build Failed

Failed CI Steps

History

cc @teresaromero

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.

Create data-stream command doesn't create a valid manifest with mappings.subobject = false
4 participants