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

feat: Add google.api/http to ts-proto-descriptors. #1078

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions protos/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ protoc \
--ts_proto_out=. \
--ts_proto_opt=esModuleInterop=true,useExactTypes=false,initializeFieldsAsUndefined=false,exportCommonSymbols=false,unknownFields=true,usePrototypeForDefaults=true,outputExtensions=true,disableProto2Optionals=true \
./google/protobuf/descriptor.proto \
./google/api/annotations.proto \
./google/api/http.proto \
./google/protobuf/compiler/plugin.proto

./node_modules/.bin/tsc -p tsconfig.json
Expand Down
31 changes: 31 additions & 0 deletions protos/google/api/annotations.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.api;

import "google/api/http.proto";
import "google/protobuf/descriptor.proto";

option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";

extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}
41 changes: 41 additions & 0 deletions protos/google/api/annotations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.

Check failure on line 1 in protos/google/api/annotations.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Argument of type 'HttpRule | undefined' is not assignable to parameter of type 'HttpRule'.
// versions:
// protoc-gen-ts_proto v1.175.1
// protoc v3.21.12
// source: google/api/annotations.proto

/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { HttpRule } from "./http";

export const http: Extension<HttpRule | undefined> = {
number: 72295728,
tag: 578365826,
repeated: false,
packed: false,
encode: (value: HttpRule | undefined): Uint8Array[] => {
const encoded: Uint8Array[] = [];
const writer = _m0.Writer.create();
HttpRule.encode(value, writer.fork()).ldelim();
encoded.push(writer.finish());
return encoded;
},
decode: (tag: number, input: Uint8Array[]): HttpRule | undefined => {
const reader = _m0.Reader.create(input[input.length - 1] ?? fail());
return HttpRule.decode(reader, reader.uint32());
},
};

export interface Extension<T> {
number: number;
tag: number;
singularTag?: number;
encode?: (message: T) => Uint8Array[];
decode?: (tag: number, input: Uint8Array[]) => T;
repeated: boolean;
packed: boolean;
}

function fail(message?: string): never {
throw new globalThis.Error(message ?? "Failed");
}
Loading
Loading