diff --git a/example/bookstore/v1/bookstore.pb.apigw.go b/example/bookstore/v1/bookstore.pb.apigw.go index 99ad0e5..a42dea6 100644 --- a/example/bookstore/v1/bookstore.pb.apigw.go +++ b/example/bookstore/v1/bookstore.pb.apigw.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-apigw 0.1.24 from bookstore/v1/bookstore.proto. DO NOT EDIT +// Code generated by protoc-gen-apigw 0.1.25 from bookstore/v1/bookstore.proto. DO NOT EDIT package v1 import ( @@ -310,19 +310,52 @@ func _BookstoreService_GetBook_APIGW_Decoder(ctx context.Context, input apigw_v1 unmarshalOpts := proto.UnmarshalOptions{AllowPartial: true, Merge: true, RecursionLimit: protowire.DefaultRecursionLimit} _ = unmarshalOpts - vn4 := input.Query().Get("author") + vn4 := input.Query().Get("page_token") - vn5tmp, err := strconv.ParseBool(strings.ToLower(vn4)) + vn5 := protopack.Message{ + protopack.Tag{Number: 5, Type: protopack.BytesType}, + protopack.String(vn4), + } + + err = unmarshalOpts.Unmarshal(vn5.Marshal(), out) + if err != nil { + return err + } + + vn6 := input.Query().Get("author") + + vn7tmp, err := strconv.ParseBool(strings.ToLower(vn6)) if err != nil { return status.Errorf(codes.InvalidArgument, "includeAuthor is not a valid bool: %s", err) } - vn5 := protopack.Message{ + vn7 := protopack.Message{ protopack.Tag{Number: 3, Type: protopack.VarintType}, - protopack.Bool(vn5tmp), + protopack.Bool(vn7tmp), } - err = unmarshalOpts.Unmarshal(vn5.Marshal(), out) + err = unmarshalOpts.Unmarshal(vn7.Marshal(), out) + if err != nil { + return err + } + + vn8 := input.Query().Get("page_size") + + if vn8 == "" { + vn8 = "0" + } + + vn9tmp, err := strconv.ParseInt(vn8, 10, 64) + if err != nil { + return status.Errorf(codes.InvalidArgument, "pageSize is not a valid int: %s", err) + } + + vn9 := protopack.Message{ + protopack.Tag{Number: 4, Type: protopack.VarintType}, + protopack.Varint(vn9tmp), + } + + err = unmarshalOpts.Unmarshal(vn9.Marshal(), out) if err != nil { return err } @@ -341,6 +374,10 @@ func _BookstoreService_GetBook_APIGW_Decoder(ctx context.Context, input apigw_v1 vn2 := input.PathParam("1") + if vn2 == "" { + vn2 = "0" + } + vn3tmp, err := strconv.ParseInt(vn2, 10, 64) if err != nil { return status.Errorf(codes.InvalidArgument, "book is not a valid int: %s", err) @@ -551,6 +588,10 @@ func _BookstoreService_GetAuthor_APIGW_Decoder(ctx context.Context, input apigw_ vn0 := input.PathParam("0") + if vn0 == "" { + vn0 = "0" + } + vn1tmp, err := strconv.ParseInt(vn0, 10, 64) if err != nil { return status.Errorf(codes.InvalidArgument, "author is not a valid int: %s", err) diff --git a/example/bookstore/v1/bookstore.pb.bookstore_service.oas31.yaml b/example/bookstore/v1/bookstore.pb.bookstore_service.oas31.yaml index 7daf131..d8fc0c8 100644 --- a/example/bookstore/v1/bookstore.pb.bookstore_service.oas31.yaml +++ b/example/bookstore/v1/bookstore.pb.bookstore_service.oas31.yaml @@ -412,11 +412,22 @@ paths: The ID of the book to retrieve. format: int64 type: string + - in: query + name: page_token + schema: + description: The pageToken field. + type: string - in: query name: author schema: description: The includeAuthor field. type: boolean + - in: query + name: page_size + schema: + description: The pageSize field. + format: int32 + type: number responses: "200": content: diff --git a/example/bookstore/v1/bookstore.pb.go b/example/bookstore/v1/bookstore.pb.go index 913eb56..9a57312 100644 --- a/example/bookstore/v1/bookstore.pb.go +++ b/example/bookstore/v1/bookstore.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.28.1 // protoc (unknown) // source: bookstore/v1/bookstore.proto @@ -381,6 +381,7 @@ type GetAuthorResponse struct { Author *Author `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` // Types that are assignable to Genre: + // // *GetAuthorResponse_Fiction // *GetAuthorResponse_Nonfiction Genre isGetAuthorResponse_Genre `protobuf_oneof:"genre"` @@ -1031,8 +1032,10 @@ type GetBookRequest struct { // The ID of the shelf from which to retrieve a book. Shelf string `protobuf:"bytes,1,opt,name=shelf,proto3" json:"shelf,omitempty"` // The ID of the book to retrieve. - Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` - IncludeAuthor bool `protobuf:"varint,3,opt,name=include_author,json=includeAuthor,proto3" json:"include_author,omitempty"` + Book int64 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` + IncludeAuthor bool `protobuf:"varint,3,opt,name=include_author,json=includeAuthor,proto3" json:"include_author,omitempty"` + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` } func (x *GetBookRequest) Reset() { @@ -1088,6 +1091,20 @@ func (x *GetBookRequest) GetIncludeAuthor() bool { return false } +func (x *GetBookRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetBookRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + // Request message for UpdateBook method type UpdateBookRequest struct { state protoimpl.MessageState @@ -1346,100 +1363,107 @@ var file_bookstore_v1_bookstore_proto_rawDesc = []byte{ 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x61, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x68, 0x65, 0x6c, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x22, - 0x51, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x6f, - 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, - 0x6f, 0x6b, 0x22, 0x3b, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x9d, 0x01, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x73, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x51, 0x0a, 0x11, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, - 0x2a, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x32, 0xe6, 0x08, 0x0a, 0x10, - 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x72, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, - 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x9a, 0xde, 0x03, 0x1a, 0x0a, 0x18, 0x0a, 0x03, 0x47, 0x45, - 0x54, 0x12, 0x08, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x07, 0x53, 0x68, 0x65, - 0x6c, 0x76, 0x65, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, - 0x68, 0x65, 0x6c, 0x66, 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, - 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x9a, 0xde, 0x03, 0x2d, 0x0a, - 0x2b, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x12, 0x06, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x4a, - 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x4e, 0x65, 0x77, 0x20, 0x53, 0x68, - 0x65, 0x6c, 0x66, 0x52, 0x07, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x7d, 0x0a, 0x0b, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x20, 0x2e, 0x62, 0x6f, - 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, - 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x29, 0x9a, 0xde, 0x03, 0x25, 0x0a, 0x23, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, - 0x12, 0x10, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, - 0x66, 0x7d, 0x52, 0x07, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x86, 0x01, 0x0a, 0x0a, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, - 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, - 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x9a, - 0xde, 0x03, 0x31, 0x0a, 0x2f, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x12, 0x16, 0x2f, 0x73, 0x68, - 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x2f, 0x62, 0x6f, - 0x6f, 0x6b, 0x73, 0x42, 0x08, 0x08, 0x01, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, - 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, - 0x12, 0x1c, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x9a, - 0xde, 0x03, 0x51, 0x0a, 0x4f, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x12, 0x1d, 0x2f, 0x73, 0x68, 0x65, + 0x3b, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x2a, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x32, 0x9b, 0x09, 0x0a, 0x10, 0x42, 0x6f, 0x6f, + 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, + 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, + 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x1e, 0x9a, 0xde, 0x03, 0x1a, 0x0a, 0x18, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x12, 0x08, + 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x52, 0x07, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, + 0x73, 0x12, 0x85, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, + 0x66, 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x9a, 0xde, 0x03, 0x2d, 0x0a, 0x2b, 0x0a, 0x04, + 0x50, 0x4f, 0x53, 0x54, 0x12, 0x06, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x4a, 0x12, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x4e, 0x65, 0x77, 0x20, 0x53, 0x68, 0x65, 0x6c, 0x66, + 0x52, 0x07, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x7d, 0x0a, 0x0b, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, + 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x6f, 0x6f, + 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x9a, + 0xde, 0x03, 0x25, 0x0a, 0x23, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x12, 0x10, 0x2f, + 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x52, + 0x07, 0x53, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x12, 0x86, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, + 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x9a, 0xde, 0x03, 0x31, + 0x0a, 0x2f, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x12, 0x16, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, + 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x42, 0x08, 0x08, 0x01, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, 0x6f, 0x6f, 0x6b, + 0x73, 0x12, 0xd2, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1c, 0x2e, + 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x62, 0x6f, + 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, + 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x89, 0x01, 0x9a, 0xde, 0x03, + 0x84, 0x01, 0x0a, 0x81, 0x01, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x12, 0x1d, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x7d, 0x1a, 0x18, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x42, 0x08, 0x08, 0x02, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, - 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, - 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x9a, 0xde, 0x03, 0x45, 0x0a, 0x43, 0x0a, 0x06, - 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x12, 0x28, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, - 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x5f, 0x69, 0x64, 0x7d, - 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x69, 0x64, 0x7d, - 0x42, 0x08, 0x08, 0x04, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, 0x6f, 0x6f, 0x6b, - 0x73, 0x12, 0x99, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, - 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x48, 0x9a, 0xde, 0x03, 0x44, 0x0a, 0x42, 0x0a, 0x05, 0x50, 0x41, 0x54, - 0x43, 0x48, 0x12, 0x28, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x6f, - 0x6f, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, - 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x69, 0x64, 0x7d, 0x42, 0x08, 0x08, 0x03, - 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x75, 0x0a, - 0x09, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x6f, 0x6f, - 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, - 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x9a, 0xde, 0x03, - 0x23, 0x0a, 0x21, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x12, 0x11, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x73, 0x2f, 0x7b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x7d, 0x52, 0x07, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x73, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x64, 0x75, 0x63, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x77, 0x2f, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x68, 0x6f, 0x72, 0x1a, 0x16, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x12, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x1a, 0x18, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x08, 0x08, 0x02, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, + 0x05, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x9a, 0xde, 0x03, 0x45, 0x0a, 0x43, + 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x12, 0x28, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, + 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x5f, 0x69, + 0x64, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x69, + 0x64, 0x7d, 0x42, 0x08, 0x08, 0x04, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, 0x6f, + 0x6f, 0x6b, 0x73, 0x12, 0x99, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, + 0x6f, 0x6b, 0x12, 0x1f, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x9a, 0xde, 0x03, 0x44, 0x0a, 0x42, 0x0a, 0x05, 0x50, + 0x41, 0x54, 0x43, 0x48, 0x12, 0x28, 0x2f, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x7b, + 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x66, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x69, 0x64, 0x7d, 0x42, 0x08, + 0x08, 0x03, 0x12, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x12, + 0x75, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x1e, 0x2e, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x62, + 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x9a, + 0xde, 0x03, 0x23, 0x0a, 0x21, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x12, 0x11, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x73, 0x2f, 0x7b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x7d, 0x52, 0x07, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x75, 0x63, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x77, 0x2f, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/example/bookstore/v1/bookstore.proto b/example/bookstore/v1/bookstore.proto index 7dddfdd..94eee89 100644 --- a/example/bookstore/v1/bookstore.proto +++ b/example/bookstore/v1/bookstore.proto @@ -62,6 +62,14 @@ service BookstoreService { { key: "author", value: "include_author" + }, + { + key: "page_size", + value: "page_size" + }, + { + key: "page_token", + value: "page_token" } ]; terraform_entity: { @@ -233,6 +241,8 @@ message GetBookRequest { // The ID of the book to retrieve. int64 book = 2; bool include_author = 3; + int32 page_size = 4; + string page_token = 5; } // Request message for UpdateBook method diff --git a/internal/apigw/apigw_method.go b/internal/apigw/apigw_method.go index a1aca5a..4efa889 100644 --- a/internal/apigw/apigw_method.go +++ b/internal/apigw/apigw_method.go @@ -258,6 +258,8 @@ func (module *Module) generateFieldConverter(method pgs.Method, edgeNumber proto return nil, fmt.Errorf("apigw: methodContext: operation.Route invalid: target field is map '%s'", method.FullyQualifiedName()) case isInt(edgeField.Type().ProtoType()): ix.Strconv = true + ix.GRPCStatus = true + ix.GRPCCodes = true converter, err := templateExecToString("field_int.tmpl", &intFieldContext{ FieldName: jsonName(edgeField), Getter: valueGetter, diff --git a/internal/apigw/templates/field_int.tmpl b/internal/apigw/templates/field_int.tmpl index 4c8b39a..d38acc4 100644 --- a/internal/apigw/templates/field_int.tmpl +++ b/internal/apigw/templates/field_int.tmpl @@ -1,5 +1,9 @@ {{ .Getter }} +if {{.InputName}} == "" { + {{.InputName}} = "0" +} + {{.OutputName}}tmp, err := strconv.ParseInt({{.InputName}}, 10, 64) if err != nil { return status.Errorf(codes.InvalidArgument, "{{.FieldName}} is not a valid int: %s", err)