Skip to content

fix: correctly generate consistent media type for type aliases#2411

Merged
jamietanna merged 1 commit into
mainfrom
fix/inconsistent-types
Jun 18, 2026
Merged

fix: correctly generate consistent media type for type aliases#2411
jamietanna merged 1 commit into
mainfrom
fix/inconsistent-types

Conversation

@jamietanna

Copy link
Copy Markdown
Member

Without this change, we'll generate i.e.

ApplicationvndApiJSON422 *CreateItem422ApplicationvndApiJSONResponseBody

Instead of

ApplicationvndApiJSON422 *CreateItem422ApplicationVndAPIPlusJSONResponseBody

As the type doesn't exist, this introduces a compilation error.

We can instead make sure we're consistently generating the media type
name.

Co-authored-by: Claude Sonnet 4.6 jamie.tanna+claude-code@rootly.com

Without this change, we'll generate i.e.

    ApplicationvndApiJSON422 *CreateItem422ApplicationvndApiJSONResponseBody

Instead of

    ApplicationvndApiJSON422 *CreateItem422ApplicationVndAPIPlusJSONResponseBody

As the type doesn't exist, this introduces a compilation error.

We can instead make sure we're consistently generating the media type
name.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
@jamietanna
jamietanna requested a review from a team as a code owner June 18, 2026 07:42
@jamietanna jamietanna added the bug Something isn't working label Jun 18, 2026
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes response body type naming for vendored JSON media types. The main changes are:

  • Uses the shared media-type CamelCase helper for response body tags.
  • Adds a minimal application/vnd.api+json regression fixture.
  • Checks in generated client/model code showing the corrected alias target.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The naming change matches the sibling response generation path already used for vendored JSON media types.

Important Files Changed

Filename Overview
pkg/codegen/operations.go Aligns vendored JSON response body tag generation with the existing strict response body naming path.
internal/test/issue-vnd-json/schema.gen.go Generated fixture now points the vendored JSON response field at the matching generated response body type.
internal/test/issue-vnd-json/spec.yaml Adds a focused OpenAPI repro for application/vnd.api+json responses with an inline union body.

Reviews (1): Last reviewed commit: "fix: correctly generate consistent media..." | Re-trigger Greptile

@jamietanna
jamietanna merged commit 0706878 into main Jun 18, 2026
29 checks passed
@jamietanna
jamietanna deleted the fix/inconsistent-types branch June 18, 2026 07:48
@jamietanna

Copy link
Copy Markdown
Member Author

A follow-up may be needed here

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant