gnostic icon indicating copy to clipboard operation
gnostic copied to clipboard

unused message don't gen swagger ?

Open dobet opened this issue 1 year ago • 1 comments

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?

dobet avatar Mar 25 '24 09:03 dobet

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

Ruff-nono avatar Apr 18 '24 08:04 Ruff-nono