Skip to content

Conversation

@lanej
Copy link
Contributor

@lanej lanej commented Dec 1, 2025

Summary

Adds automatic detection of JSON media types using the +json suffix per RFC 6838, enabling native support for application/json-patch+json, application/merge-patch+json, and vendor-specific JSON types without manual configuration.

Fixes #1587

Changes

  • Auto-detect media types with +json suffix as JSON (e.g., application/json-patch+json, application/vnd.api+json)
  • Fix response wrapper type name conflicts when multiple content types exist in the same response
  • ContentTypeAliases takes precedence (checked first)
  • Special handling for application/problem+json preserved

Test plan

  • New test file: _testdata/positive/json_suffix_content_types.yml
  • Covers: json-patch+json, merge-patch+json, vendor JSON types
  • Existing k8s.json and api.github.com.json tests exercise the new code paths
  • All tests pass
  • Lint passes

lanej added 4 commits December 1, 2025 15:23
Auto-detect media types with +json suffix as JSON per RFC 6838,
enabling native support for application/json-patch+json and similar
types without explicit ContentTypeAliases configuration.

Also fixes response wrapper naming conflicts when operations have
multiple JSON content types with different suffixes.

Fixes ogen-go#1587
Regenerate generated files with updated generator code that adds
content-type-specific names to response wrappers when multiple
content types are present.
Fix non-deterministic field ordering in ObjectEnumBar struct to match
canonical order from schema definition (type before value).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Native support for application/json-patch+json media type

1 participant