Skip to content

[BUG] Cross-package proto message fields lose descriptions #200

@cyberxnomad

Description

@cyberxnomad

If a message defined in another proto package is used, and one of its fields appears in the URI path template pattern, then that field's description will be missing in the generated openapi.yaml.

Minimal reproducible example:

./book/book.proto :

syntax = "proto3";

package book;

message ListBooksRequest {
  // the shelf description
  string shelf = 1;

  // the author description
  string author = 2;
}

message ListBooksResponse {
}

./demo.proto :

syntax = "proto3";

package demo;

import "google/api/annotations.proto";

import "book/book.proto";

service BookService {
  rpc ListBooks(book.ListBooksRequest) returns (book.ListBooksResponse) {
    option (google.api.http) = {
      get : "/v1/shelves/{shelf}/books"
    };
  }
}

partial content from generated openapi.yaml :

 1|  paths:
 2|    /v1/shelves/{shelf}/books:
 3|      get:
 4|        tags:
 5|          - BookService
 6|        summary: ListBooks
 7|        operationId: demo.BookService.ListBooks
 8|        parameters:
 9|          - name: shelf
10|            in: path
11|            required: true
12|            schema:
13|              type: string
14|              title: shelf
15|              description: the shelf description
16|          - name: author
17|            in: query
18|            description: the author description
19|            schema:
20|              type: string
21|              title: author
22|              description: the author description

description missing between lines 11-12 (present on line 18).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions