Fix generate-cli-skeleton output min constraints - #10677
Open
HuzaifaChaudary wants to merge 1 commit into
Open
HuzaifaChaudary wants to merge 1 commit into
HuzaifaChaudary wants to merge 1 commit into
Conversation
The sample response for --generate-cli-skeleton output is built from the
member names of the output shape and from zeros, and the stubber then
validates that response against the same shape. A placeholder that is
shorter than the min of its shape, or a number below it, makes the command
fail on its own sample data:
$ aws iam list-roles --generate-cli-skeleton output
Invalid length for parameter Roles[0].RoleId, value: 6,
valid min length: 16
Invalid value for parameter Roles[0].MaxSessionDuration, value: 0,
valid min value: 3600
The generator used for the stubbed response now pads a string that is too
short, raises a number to the minimum and fills a list up to the minimum
number of items. Of the 17737 operations that have an output shape, 4638
failed this validation before the change and 805 after it, and every
remaining one is a tagged union, which is a separate problem.
fixes aws#2337
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Issue #, if available: fixes #2337
Description of changes:
the sample response for
--generate-cli-skeleton outputis built from the member names of the output shape and from zeros , and the stubber then validates that response against the same shape . a placeholder that is shorter than theminof its shape , or a number below it , makes the command fail on its own sample data :the generator used for the stubbed response now pads a string that is too short , raises a number to the minimum and fills a list up to the minimum number of items . the input skeletons are untouched , this only changes the sample response .
of the 17737 operations that have an output shape , 4638 failed this validation before the change and 805 after it . every remaining one is a tagged union , where the skeleton sets all the members and the validator wants one , which is a separate problem and not fixed here .
iam list-rolesnow prints"RoleId": "RoleIdxxxxxxxxxx"and"MaxSessionDuration": 3600instead of failing . two functional tests cover a short string and a small number , and the unit tests cover strings , integers , doubles , lists , map keys and nested structures . both new functional tests fail with the old generator wired back in .generated by AI tools ( claude code , claude opus 5 ) , and reviewed by Huzaifa Iftikhar .
Testing:
pytest tests/unit tests/functionalis 98601 passed , 10 skipped , 0 failed .By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.