Skip to content

Commit

Permalink
Libs(Go): template overrides for nullable non-required containers (#1450
Browse files Browse the repository at this point in the history
)

In #1448 the `EndpointIn` model was hand-edited such that `channels` and
`filterTypes` were nullable, and thus correctly omitted from request
bodies sent to the server.

This series of commits attempts to remove the need to keep reapplying
this patch with each spec bump by updating the codegen template used to
produce the model code.

This change is comprised of 3 commits:
1. the addition of a template override for `model_simple`
([src](https://github.com/OpenAPITools/openapi-generator/blob/v5.2.0/modules/openapi-generator/src/main/resources/go/model_simple.mustache))
as-is, taken from openapi at the v5.2.0 tag (matching the version of the
generator we're using currently).
2. some modifications to said template, i.e. _our patch_.
3. updated go sources from running the generator.

When reviewing the template, it'll therefore be useful to go commit by
commit so you can see the diff applied against the upstream.

This change has widespread impact as many models are changing. I'm still
trying to figure out how we can prove everything is kosher and not
causing accidental breakage. Open to ideas 🤔

Existing tests are passing, and everything typechecks, so at the very
least the codegen output is self-consistent.
  • Loading branch information
svix-onelson authored Oct 1, 2024
2 parents ff8d49f + b2f7756 commit d543e1b
Show file tree
Hide file tree
Showing 27 changed files with 652 additions and 165 deletions.
10 changes: 5 additions & 5 deletions go/internal/openapi/model_app_usage_stats_in.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions go/internal/openapi/model_attempt_statistics_data.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions go/internal/openapi/model_auth_token_out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions go/internal/openapi/model_endpoint_message_out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions go/internal/openapi/model_endpoint_oauth_config_in.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions go/internal/openapi/model_endpoint_out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d543e1b

Please sign in to comment.