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

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

Open
chaporgin opened this issue Nov 2, 2024 · 0 comments
Open
Labels
enhancement New feature or request openapi-features OpenAPI features support issues

Comments

@chaporgin
Copy link

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.
@chaporgin chaporgin added enhancement New feature or request openapi-features OpenAPI features support issues labels Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-features OpenAPI features support issues
Projects
None yet
Development

No branches or pull requests

1 participant