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

Add ability to specify a yaml file as parameters #8133

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

aidando73
Copy link

*Issue #2275

  • Adds ability to specify a yaml file as parameters
  • Will work for any list yaml files (but not for dictionary yaml files)
Screencast.from.25-08-23.18.45.15.webm

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

result = yaml.load(check_val)
# Yaml parsing is only supported for yaml list documents as there are currently no
# known use cases for yaml map documents
if isinstance(result, list):
Copy link
Author

Choose a reason for hiding this comment

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

Wasn't sure if there was a use case for dictionary yaml documents. Let me know if you guys want to support it.

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2023

Codecov Report

Merging #8133 (f5b7fcd) into v2 (27f75db) will decrease coverage by 0.01%.
Report is 18 commits behind head on v2.
The diff coverage is 82.35%.

@@            Coverage Diff             @@
##               v2    #8133      +/-   ##
==========================================
- Coverage   93.12%   93.11%   -0.01%     
==========================================
  Files         363      363              
  Lines       38291    38308      +17     
  Branches     6127     6130       +3     
==========================================
+ Hits        35657    35670      +13     
- Misses       1963     1968       +5     
+ Partials      671      670       -1     
Files Changed Coverage Δ
awscli/argprocess.py 91.69% <82.35%> (-0.24%) ⬇️

... and 2 files with indirect coverage changes

@aidando73
Copy link
Author

I just realized there's another PR that aims to achieves something similar #5482 but with a different approach.

Up to you guys which approach you want to choose.

@aidando73
Copy link
Author

aidando73 commented Aug 26, 2023

One drawback of my approach is that it's difficult to provide useful error messages; It's difficult to determine whether the argument passed in is an invalid yaml document or shorthand or JSON - since we try and parse the full yaml document.

Alternatives might be:

  • Parse yaml files based on file extensions .yml or .yaml (though there might be use cases where file extensions are not .yml or .yaml)
  • Go with the yaml:// prefix idea

These would allow better error messages

@aidando73
Copy link
Author

The more I think about it, the more file extension based matching makes more sense. Let me know if you want me to redo this PR

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.

None yet

2 participants