Skip to content

Backport field tag customization and media type customization from oapi-codegen-exp #2368

Closed

Description

@mromaszewicz

We have a lot of assumptions about how fields should be tagged in generated models, and I'd like to retain current default behavior, but allow the users to override every aspect of this behavior.

In https://github.com/oapi-codegen/oapi-codegen-exp, I've allowed field tags to be fully customized, where users can insert their own field tags by looking at the name in the spec, whether the field is required, etc.
https://github.com/oapi-codegen/oapi-codegen-exp/blob/56dd39ec275d400ae5cdc1eed293719464bbf8c2/codegen/internal/configuration.go#L44[
](https://github.com/oapi-codegen/oapi-codegen-exp/blob/56dd39ec275d400ae5cdc1eed293719464bbf8c2/Configuration.md?plain=1#L293)

Likewise, we have some patterns that we match to identify a content-type as JSON or YAML or whatever, but they can't catch all cases, so I would also like to backport the implementation:

https://github.com/oapi-codegen/oapi-codegen-exp/blob/56dd39ec275d400ae5cdc1eed293719464bbf8c2/codegen/internal/configuration.go#L37
https://github.com/oapi-codegen/oapi-codegen-exp/blob/56dd39ec275d400ae5cdc1eed293719464bbf8c2/Configuration.md?plain=1#L265

https://github.com/oapi-codegen/oapi-codegen-exp/blob/56dd39ec275d400ae5cdc1eed293719464bbf8c2/codegen/internal/configuration.go#L41
https://github.com/oapi-codegen/oapi-codegen-exp/blob/main/Configuration.md?plain=1#L275

Activity

  1. mromaszewicz commented on Oct 31, 2026

    @mromaszewicz
    MemberAuthor

    The two commits referenced here implement this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions