Aws-cli: Shorthand parser does not handle '/', which apigateway documentation suggests is allowed

Created on 29 Dec 2015  路  7Comments  路  Source: aws/aws-cli

The API documentation for aws apigateway put-method suggests that using shorthand syntax is allowed for the --request-models parameter. The schema for this parameter is described as follows:

Request models are represented as a key/value map, with a content type as the key and a Model name as the value

Because the key in this case is a content type such as application/json, I think it seems reasonable to expect that the shorthand syntax will work with the following:

aws apigateway put-method \
  --rest-api-id "$api_id" \
  --resource-id "$resource_id" \
  --http-method POST \
  --authorization-type NONE \
  --request-models "application/json=Hookshot"

However, this results in the following error:

Error parsing parameter '--request-models': Expected: '=', received: '/' for input:
application/json=Hookshot
           ^

Looking at the shorthand parser, the error makes sense, as / doesn't appear to be an allowed character. Should it be? If not, it should the documentation be updated to not suggest using the shorthand syntax, given that it will pretty much be impossible to use for any content type?

Thanks!

investigating

Most helpful comment

@AustinBurns, you won't hit that error with --change-batch file:///path/to/file.

All 7 comments

I'm inclined to make this an allowed character in the shorthand parser. I'll need to double check that this doesn't break anything else, but I think this is a safe change to make.

This also happens for

aws route53 change-resource-record-sets \
    --hosted-zone-id $HOSTED_ZONE_ID \
    --change-batch /path/to/file
Error parsing parameter '--change-batch': Expected: '=', received: '/' for input: /path/to/file

@AustinBurns, you won't hit that error with --change-batch file:///path/to/file.

Just came across same issue with "application/json" as a shorthand syntax. In my particular scenario I'd like to avoid using JSON format, so I was wondering what's the status?

im getting this issue in route53 in windows - have tried lots of different ways of trying to format the windows file path but it always errors.Ive also tried using gitbash in windows and still get the error

Error parsing parameter '--change-batch': Expected: '=', received: ':' for input:

I upgraded AWS CLI to the latest version and solved the problem.

Both : and / should work in key names when using the short hand syntax now.
See:
https://github.com/aws/aws-cli/commit/9654993c1a26f1837e1eb10a0c531ed9ca911a33#diff-ec35d3dbcbb61f7621200a446478c020
https://github.com/aws/aws-cli/commit/edf25b0f6d194c5480247d44d7d78626a9d9ccd7#diff-ec35d3dbcbb61f7621200a446478c020

Was this page helpful?
0 / 5 - 0 ratings