-
Notifications
You must be signed in to change notification settings - Fork 42
Make bundle/upgrade print YAML if the input was YAML
#888
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
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| WRITE schema.yaml UNTIL EOF | ||
| $schema: https://json-schema.org/draft/2020-12/schema | ||
| $id: https://example.com/first | ||
| type: string | ||
| --- | ||
| $schema: https://json-schema.org/draft/2020-12/schema | ||
| $id: https://example.com/second | ||
| type: integer | ||
| EOF | ||
|
|
||
| // Not supported | ||
| RUN bundle schema.yaml STDIN /dev/null IN . INTO result_0.txt EXPECTING 3 | ||
|
|
||
| REPLACE $CWD WITH '[CWD]' IN result_0.txt | ||
|
|
||
| WRITE expected_0.txt UNTIL EOF | ||
| 2> error: This command does not support input with multiple documents | ||
| 2> at file path [CWD]/schema.yaml | ||
| EOF | ||
|
|
||
| COMPARE result_0.txt AGAINST expected_0.txt | ||
|
|
||
| // Not supported | ||
| RUN bundle schema.yaml --json STDIN /dev/null IN . INTO result_1.txt EXPECTING 3 | ||
|
|
||
| REPLACE $CWD WITH '[CWD]' IN result_1.txt | ||
|
|
||
| WRITE expected_1.txt UNTIL EOF | ||
| 1> { | ||
| 1> "error": "This command does not support input with multiple documents", | ||
| 1> "filePath": "[CWD]/schema.yaml" | ||
| 1> } | ||
| EOF | ||
|
|
||
| COMPARE result_1.txt AGAINST expected_1.txt |
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,26 @@ | ||
| WRITE input.yaml UNTIL EOF | ||
| $schema: https://json-schema.org/draft/2020-12/schema | ||
| $id: https://example.com | ||
| $ref: nested | ||
| EOF | ||
|
|
||
| WRITE remote.yaml UNTIL EOF | ||
| $schema: https://json-schema.org/draft/2020-12/schema | ||
| $id: https://example.com/nested | ||
| type: string | ||
| EOF | ||
|
|
||
| RUN bundle - --resolve remote.yaml STDIN input.yaml IN . INTO result.txt EXPECTING 0 | ||
|
|
||
| WRITE expected.txt UNTIL EOF | ||
| 1> $schema: https://json-schema.org/draft/2020-12/schema | ||
| 1> $id: https://example.com | ||
| 1> $ref: nested | ||
| 1> $defs: | ||
| 1> https://example.com/nested: | ||
| 1> $schema: https://json-schema.org/draft/2020-12/schema | ||
| 1> $id: https://example.com/nested | ||
| 1> type: string | ||
| EOF | ||
|
|
||
| COMPARE result.txt AGAINST expected.txt |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/command_bundle.cc:45: In preserve mode,read_yaml_fileflags subsequent YAML documents inparsed_schema.multidocument, but this command never inspects it; a multi-document YAML file therefore bundles only the first document and silently drops the rest from stdout.read_from_stdinrejects this case, so file and stdin inputs now behave inconsistently. Other locations where this applies:src/command_upgrade.cc:182.Severity: medium
Other Locations
src/command_upgrade.cc:182🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.