Skip to content

ease of collaborative work: file per schemas, client, server methods #1339

Open
@chaporgin

Description

@chaporgin

Hello and thank you for your great library.

Description

We commit the generated code into the repository. We work on some specifications resolving 5 features simultaneously. 2 developers rarely work on the same endpoint. Considering that, 4 pull requests with specification changes are often subject to rebase after one lucky person commits to the main branch. Thinking of how to improve the workflow I thought that the rebases would be less needed if the generated code were split more. Currently, we have the following files (among the others):

  • oas_schemas_gen.go
  • oas_client_gen.go
  • oas_handlers_gen.go
  • oas_request_decoders_gen.go
  • oas_request_encoders_gen.go
  • oas_response_decoders_gen.go
  • oas_response_encoders_gen.go

I believe they are the only source of frequent conflicts, unless when 2 new endpoints are being added, in that case oas_router_gen.go adds to the list above, but I believe this case should be out of scope.

My suggestion is to generate more files, so that:

  • each server endpoint handler has it's own file
  • each client endpoint handler has it's own file
  • each schema has its file.

Downsides:

  • looks ugly. Question of taste, I'd say, I don't care much if generated files are named something-something_1_gen.go, something-something_2_gen.go if they serve better to the developer productivity.
  • slightly increased compilation times. I believe it isn't very important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions