镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

unused message don't gen swagger ? #435

Open

Description

@dobet

I have 2 message used to an Any field

message AnyItem {
  option (openapi.v3.schema) = {
    title: "AnyItem";
    required: "true";
  };
  map<string, string> data = 1;
}

message AnyItem2 {
  option (openapi.v3.schema) = {
    title: "AnyItem2";
    required: "true"
  };
  repeated string data = 1;
}

// The response message containing the greetings
message HelloReply {
  string name = 1;
  repeated google.protobuf.Any data = 2 [
    (openapi.v3.property) = {
      required: [
        "AnyItem", "AnyItem2"
      ]
      items: {
        schema_or_reference: [
          {
            reference: {
              _ref: "#/components/schemas/AnyItem"
            }
          },
          {
            reference: {
              _ref: "#/components/schemas/AnyItem2"
            }
          }
        ]
      }
    }
  ];
}

but I got an openapi.yaml that don't have AnyItem and AnyItem2, and protobuf.Any don't convert

        helloworld.v1.HelloReply:
            type: object
            properties:
                name:
                    type: string
                data:
                    required:
                        - AnyItem
                        - AnyItem2
                    type: array
                    items:
                        - $ref: '#/components/schemas/google.protobuf.Any'
                        - $ref: '#/components/schemas/AnyItem'
                        - $ref: '#/components/schemas/AnyItem2

what can I do , the helloReply can ref AnyItem and AnyItem2?

Activity

  1. Ruff-nono commented on Apr 18, 2024

    @Ruff-nono

    I have the same issue, somtimes I hope to define some global components based on the message, which can be referenced when needed. but It seems that only messages referenced by the defined RPC service are effective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions