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

unused message don't gen swagger ? #435

Open
dobet opened this issue Mar 25, 2024 · 1 comment
Open

unused message don't gen swagger ? #435

dobet opened this issue Mar 25, 2024 · 1 comment

Comments

@dobet
Copy link

dobet commented Mar 25, 2024

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?

@Ruff-nono
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants