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

private/protocol/restjson: Define JSONValue marshaling for body and querystring #1640

Merged
merged 6 commits into from
Nov 17, 2017

Conversation

jasdel
Copy link
Contributor

@jasdel jasdel commented Nov 9, 2017

Adds support for APIs which use JSONValue for body and querystring targets.

Fix #1636

@jasdel jasdel self-assigned this Nov 9, 2017
@@ -1354,6 +1387,27 @@
"name": "OperationName"
},
"params": {
"Body": {
"BodyListField": [{"Foo":"Bar"}]
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is testing for empty output, may want to have nothing in the params.

"response": {
"status_code": 200,
"headers": {},
"body": "{\"BodyListField\":[\"{\\\"Foo\\\":\\\"Bar\\\"}\"]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

if err != nil {
return fmt.Errorf("unable to encode JSONValue, %v", err)
}
buf.WriteString(str)
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized we squash all these error. Is that something we want to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely want to return errors from these functions. If the protocol marshaler is squashing them then those marshalers should be updated not to squash the errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah you mean errors on write, sorry missed that. Those should be captured... I don't think the SDK does that for any writes currently like this since the type is a bytes.buffer.

fmt.Println("JSONVAlue decode", u, v, err)
b = []byte(u)
default:
b = []byte(v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to default to NoEscape? We may want to check for NoEscape in a switch case and return an error, if it is of invalid escaping type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about this do a switch on the known types and return an error if the escape mode is a value that is unknown.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, that sounds good

@@ -0,0 +1,69 @@
package protocol
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to add tests for these new functions.

@jasdel jasdel merged commit 549578a into aws:master Nov 17, 2017
jasdel added a commit that referenced this pull request Nov 17, 2017
@awstools awstools mentioned this pull request Nov 17, 2017
@jasdel jasdel deleted the AddJSONValueBody branch March 26, 2021 18:13
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.

2 participants