Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enums are not parsed correctly by v3alpha API when sent as JSON #5942

Closed
jbaron-gingco opened this issue Jul 14, 2016 · 1 comment · Fixed by #5969
Closed

Enums are not parsed correctly by v3alpha API when sent as JSON #5942

jbaron-gingco opened this issue Jul 14, 2016 · 1 comment · Fixed by #5969
Assignees
Labels
Milestone

Comments

@jbaron-gingco
Copy link

I sent the following JSON document to the endpoint /v3alpha/auth/role/grant:

{
    "name": "myRoleName",
    "perm": {
        "permType": "READ",
        "key": "some key",
        "range_end": "some range end"
    }
}

The response was:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Thu, 14 Jul 2016 14:31:31 GMT      
Content-Length: 75

{"Error":"unknown value \"READ\" for enum authpb.Permission_Type","Code":3}

It worked when sending this request:

{
    "name": "myRoleName",
    "perm": {
        "permType": 0,
        "key": "some key",
        "range_end": "some range end"
    }
}

0 is the enum value for "READ".

I would have expected that the value "READ" works, since the protobuf3 documentation says so.

@gyuho
Copy link
Contributor

gyuho commented Jul 15, 2016

I think this is compatibility issue between upstream packages. I reported here gogo/protobuf#189.

Thanks for reporting.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants