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

protoc-gen-swagger: Support for repeated custom message in url params #1119

Closed
glossd opened this issue Jan 21, 2020 · 3 comments
Closed

protoc-gen-swagger: Support for repeated custom message in url params #1119

glossd opened this issue Jan 21, 2020 · 3 comments

Comments

@glossd
Copy link

glossd commented Jan 21, 2020

I'm trying to use pagination with gRPC like this

rpc ListThing (ListThingRequest) returns (ListThingResponse) {
    option (google.api.http).get = "/v1/things"
}

message ListThingRequest {
    int32 page_number = 1;
    int32 page_size = 2;
    repeated OrderField sort = 3;
}
message OrderField {
    string field = 1;
    Order order = 2;
}

enum Order {
    ASC = 0;
    DESC = 1;
}

but the sort doesn't get generated. PR with support for map not merged yet...
What are the options?

@johanbrandhorst
Copy link
Collaborator

Could perhaps use specific types for the fields you want to order? Do you need to support more than one field order at a time?

@glossd
Copy link
Author

glossd commented Jan 22, 2020

Yeah, I need to support more than one field in one query for sorting. What do you mean by specific types?

@johanbrandhorst
Copy link
Collaborator

AgeOrder, NameOrder... the more specific you can make it the safer it will be to consume your API. More dynamic = less guarantees.

@glossd glossd closed this as completed Jan 25, 2020
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

No branches or pull requests

2 participants