awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.15k stars 770 forks source link

Coerce operation params according to model #147

Closed joguSD closed 7 years ago

joguSD commented 7 years ago

This pull requests adds a basic framework for coercing parameters into the correct type. Input taken from prompts will always be strings and for some basic types it is easy enough to cast them implicitly rather than having to define explicitly what type it is in the wizard specification or have a custom interaction.

kyleknap commented 7 years ago

Approach looks fine. I just had a few questions. Parameter translation based off model traversal has a fair amount of edge cases and there is a bunch of places in botocore where we do it so I would make sure you take a look at those. The places we do it notably is: serializers, response parsers, and documentation.

JordonPhillips commented 7 years ago

It really is a shame that we can't use the CLI, but this is a fairly well known problem as Kyle mentioned. Looks good for the most part, just a few small comments.

JordonPhillips commented 7 years ago

                       _____|\
                  _.--| SSt |:
                 <____|.----||
                        .---''---,
                         ;..__..'    _...
                       ,'/  ;|/..--''    \
                     ,'_/.-/':            :
                _..-'''/  /  |  \    \   _|/|
               \      /-./_ \;   \    \,;'   \
               ,\    / \:  `:\    \   //    `:`.
             ,'  \  /-._;   | :    : ::    ,.   .
           ,'     ::   /`-._| |    | || ' :  `.`.)
        _,'       |;._:: |  | |    | `|   :    `'
      ,'   `.     /   |`-:_ ; |    |  |  : \
      `--.   )   /|-._:    :          |   \ \
         /  /   :_|   ;`-._;   __..--';    : :
        /  (    ;|;-./_  _/.-:'o |   /     ' |
       /  , \._/_/_./--''/_|:|___|_,'        |
      :  /   `'-'--'----'---------'          |
      | :     O ._O   O_. O ._O   O_.      ; ;
      : `.      //    //    //    //     ,' /
    ~~~`.______//____//____//____//_______,'~
              //    //~   //    //
       ~~   _//   _//   _// ~ _//     ~
     ~     / /   / /   / /   / /  ~      ~~
          ~~~   ~~~   ~~~   ~~~
kyleknap commented 7 years ago

Looks good. I am not sure about a better name than coerce but :ship: if you can't think of a better name either.