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

Duplicate message descriptors generated for request schemas whose names end with "Request" #93

Open
TylerGillson opened this issue Jun 20, 2023 · 1 comment

Comments

@TylerGillson
Copy link
Contributor

Steps to reproduce:

  1. Add the following to generator/testfiles/requestBodies.yaml:
/testRequestBodySchemaReference:
    post:
      operationId: testRequestBodySchemaReference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestRequestBodySchemaReferenceRequest'
      responses:
        "201":
          description: OK
components:
  schemas:
    TestRequestBodySchemaReferenceRequest:
      type: object
      properties:
        person:
          $ref: '#/components/schemas/Person'
  1. Execute TestFileDescriptorGeneratorRequestBodies to generate an updated .proto file
  2. Observe the following duplication:
message TestRequestBodySchemaReferenceRequest {
  Person person = 1;
}

message Person {
  int64 id = 1;

  int64 age = 2;

  string name = 3;

  repeated string photo_urls = 4;
}

//TestRequestBodySchemaReferenceParameters holds parameters to TestRequestBodySchemaReference
message TestRequestBodySchemaReferenceRequest {
  TestRequestBodySchemaReferenceRequest test_request_body_schema_reference_request = 1;
}

service Requestbodies {
  rpc TestRequestBody ( TestRequestBodyRequest ) returns ( google.protobuf.Empty ) {
    option (google.api.http) = { get:"/testRequestBody" body:"person"  };
  }

  rpc TestRequestBodyReference ( TestRequestBodyReferenceRequest ) returns ( google.protobuf.Empty ) {
    option (google.api.http) = { get:"/testRequestBodyReference" body:"person"  };
  }

  rpc TestRequestBodySchemaReference ( TestRequestBodySchemaReferenceRequest ) returns ( google.protobuf.Empty ) {
    option (google.api.http) = { post:"/testRequestBodySchemaReference" body:"test_request_body_schema_reference_request"  };
  }
}
@LorenzHW
Copy link
Collaborator

LorenzHW commented Jun 20, 2023

I see. Thanks! Need to think about that a bit 🤔

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