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 support for marshalling/unmarshalling JSON #6969

Merged
merged 2 commits into from
Jan 16, 2020

Conversation

jhendrixMSFT
Copy link
Member

Removed Response.Payload field, replacing it with an internal
implementation nopClosingBytesReader.

Removed Response.Payload field, replacing it with an internal
implementation nopClosingBytesReader.
if len(r.payload()) == 0 {
return newRequestError("missing payload", r)
return nil
Copy link
Member

Choose a reason for hiding this comment

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

Just a question, to understand the reason behind returning nil, wouldn't it be better to return an error is the payload empty? Since clearly calling the function means that there was the expectation that something would be unmarshaled?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my original assumption, however the byte_getNull test expects this to be valid. I actually think the swagger is malformed, i.e. the MIME type should be application/text and not application/json as none of the models are actually JSON. We also have this same behavior in track 1, but again it might be predicated on some bad assumptions (i.e. is there ever a valid success case where the swagger specifies a JSON model but the service is allowed to return null).

Copy link
Member

@catalinaperalta catalinaperalta left a comment

Choose a reason for hiding this comment

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

LGTM, just left a question to understand the error handling we're going to use for UnmarshalAsJSON

@jhendrixMSFT jhendrixMSFT merged commit dfc6a17 into Azure:master Jan 16, 2020
@jhendrixMSFT jhendrixMSFT deleted the azcore_json branch January 16, 2020 00:59
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