-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Description
Given this service definitions:
service WorkspaceService {
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
option (google.api.http) = {get: "/api/v1/{name=workspace/settings/*}"};
option (google.api.method_signature) = "name";
}
message GetWorkspaceSettingRequest {
// The resource name of the workspace setting.
// Format: workspace/settings/{setting}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.memos.dev/WorkspaceSetting"}
];
}
I would expect a path to be generated like this:
paths:
/api/v1/{name}:
get:
tags:
- WorkspaceService
description: Gets a workspace setting.
operationId: WorkspaceService_GetWorkspaceSetting
parameters:
- name: name
in: path
description: The setting id.
required: true
schema:
type: string
This is the offending code:
gnostic/cmd/protoc-gen-openapi/generator/generator.go
Lines 508 to 516 in e0e09f7
// The starred path is assumed to be in the form "things/*/otherthings/*". | |
// We want to convert it to "things/{thingsId}/otherthings/{otherthingsId}". | |
for i := 0; i < len(parts)-1; i += 2 { | |
section := parts[i] | |
namedPathParameter := g.findAndFormatFieldName(section, inputMessage) | |
namedPathParameter = singular(namedPathParameter) | |
parts[i+1] = "{" + namedPathParameter + "}" | |
namedPathParameters = append(namedPathParameters, namedPathParameter) | |
} |
Here is the description of the feature from the Transcoding proto:
https://github.com/googleapis/googleapis/blob/f8776fec04e336527ba7279d960105533a1c4e21/google/api/http.proto#L68
Metadata
Metadata
Assignees
Labels
No labels