pipelineymlgen: make inlinerange more consistent and usable#462
Open
pipelineymlgen: make inlinerange more consistent and usable#462
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates pipelineymlgen’s inlinerange behavior to make output shape more predictable (map vs sequence) and improves usability by making the loop body’s YAML type control how results are inlined, with updated docs and expanded test coverage/examples.
Changes:
- Adjust
inlinerangeevaluation to merge mapping bodies into mappings and sequence bodies into sequences, and to error on bare scalar bodies. - Update and expand
inlinerangetests (including new examples and new error-case fixtures) to reflect the new, more explicit YAML shapes. - Update
pipelineymlgenREADME documentation to describe ordering, body-type semantics, and provide example links.
Reviewed changes
Copilot reviewed 24 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/pipelineymlgen/eval.go |
Changes how inlinerange bodies are collected/merged; tightens mapping/sequence conversion; adds scalar-body error. |
cmd/pipelineymlgen/README.md |
Updates inlinerange semantics and adds examples describing mapping vs sequence insertion and scalar-body errors. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-processed-keys.gen.yml |
Adjusts typed-slice test input to the new sequence-body style. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-processed-keys.golden.yml |
Updates expected output for typed-slice test. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-map-order.gen.yml |
Adjusts map-order test to produce a mapping (not a sequence of singleton maps). |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-map-order.golden.yml |
Updates expected output for deterministic sorted map iteration. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-3arg.gen.yml |
Updates 3-arg form test to use explicit sequence body items. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-3arg.golden.yml |
New expected output for 3-arg form. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-2arg.gen.yml |
Updates 2-arg form test to use explicit sequence body items. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-2arg.golden.yml |
New expected output for 2-arg form. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-1arg.gen.yml |
Adds replacement for scalar/no-varname test using explicit sequence body items. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-1arg.golden.yml |
Expected output for 1-arg scalar iteration. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-1arg-map.gen.yml |
Adds 1-arg map iteration test (values only). |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-1arg-map.golden.yml |
Expected output for 1-arg map iteration. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-examples.gen.yml |
Adds a comprehensive “how to shape output” examples file. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-examples.golden.yml |
Golden output for the examples file. |
internal/pipelineymlgen/testdata/TestEndToEnd/inlinerange-map-yaml-order/map-order.gen.yml |
Updates end-to-end YAML-sourced map iteration to the new sequence-body style. |
internal/pipelineymlgen/testdata/TestEndToEnd/inlinerange-filter/inlinerange-filter.gen.yml |
Adjusts filtering example indentation/structure to the new style. |
internal/pipelineymlgen/testdata/TestEndToEnd/inlinerange-filter/images-filter.gen.yml |
Adjusts filtering example indentation/structure to the new style. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-value-into-seq.gen.yml |
Adds a negative test for scalar body in sequence context. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-value-into-seq.golden.txt |
Expected error message for scalar body in sequence context. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-value-into-map.gen.yml |
Adds a negative test for scalar body in mapping context. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-value-into-map.golden.txt |
Expected error message for scalar body in mapping context. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-seq-into-map.gen.yml |
Adds a negative test for sequence body in mapping context. |
internal/pipelineymlgen/testdata/TestIndividualFileErrors/inline-seq-into-map.golden.txt |
Expected error message for sequence body in mapping context. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-scalar.gen.yml |
Removes older scalar test fixture in favor of new 1-arg fixtures. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-replace-data.gen.yml |
Removes older “replace data entirely” test fixture. |
internal/pipelineymlgen/testdata/TestIndividualFiles/inlinerange-replace-data.golden.yml |
Removes golden output for removed fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 32 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Not reachable from current usage, but this makes the code more consistent for the future.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Make the input requirements of
pipelineymlgenmore consistent and make the output more predictable. The current implementation tends to over-inline or result in a sequence when a map is needed, making some output impossible to achieve.