[REQ/PROPOSAL/OFFER TO IMPLEMENT] - Native OpenAPI Overlay Support

Đang mở
#25,661 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
22/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, openapi
Lĩnh vực
api, build-system

Hướng nghiên cứu

The payload names no source files. Start by reading how the generator loads and parses the input spec before code generation, since overlays must be applied at that point, and how the CLI, Gradle and Maven plugins pass the spec in. The author wants maintainers to agree on the integration approach (for example the overlay-jvm dependency) before any code is written, so check for a reply first. Done means one or more overlay files are applied before parsing, with tests across the CLI and build plugins.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Enhancement: Feature
Is your feature request related to a problem? Please describe.

Customizing OpenAPI specifications for code generation currently requires modifying the original spec, using generator-specific configuration options, or introducing external preprocessing steps.

This is particularly relevant when dealing with imperfect or non-compliant OpenAPI specifications that cannot be modified at their source.

Additionally, some generators already provide complex configuration options to inject vendor extensions without modifying the original specification. A standardized overlay mechanism could reduce the need to implement and maintain such generator-specific workarounds.

Describe the solution you'd like

Support the OpenAPI Overlay Specification natively, allowing one or more overlay files to be passed alongside the original specification.

Overlays should be applied before parsing and code generation, with support across CLI, Gradle, and Maven integrations.

This would enable users to:

  • Inject vendor extensions: Add x-implements, x-class-extra-annotation, or x-spring-paginated without modifying the source specification.
  • Customize schemas: Add missing properties, change property types, rename properties, or adjust required constraints.
  • Work around problematic specifications: Fix incorrect schema definitions, missing metadata, or other issues in externally maintained OpenAPI documents.
  • Customize operations: Add annotations, modify parameters, or exclude certain endpoints from generation.
  • Apply cross-cutting customizations: Use JSONPath expressions to apply common metadata or modifications across multiple schemas or operations.

It could also reduce the maintenance burden on OpenAPI Generator by providing a standardized alternative to generator-specific configuration options such as schemaImplements or typeInfoDefaultImpls, where equivalent vendor extensions already exist.

Describe alternatives you've considered

External preprocessing using tools such as Redocly CLI or custom build tasks.

Additional context

overlay-jvm could be a suitable implementation dependency because it:

  • Is written in Java and can integrate directly into the existing generator pipeline.
  • Provides a simple API for applying overlays to OpenAPI documents.
  • Supports JSON/YAML and standards-based JSONPath expressions.
  • Implements OpenAPI Overlay Specification 1.1.0.
  • Avoids introducing external tools or runtimes into the generation workflow.

Its focused scope could make integration relatively straightforward, although compatibility with newer Overlay Specification versions would need consideration.

I'd be willing to work on implementing this feature and submit a PR, provided the maintainers are open to the approach. Feedback on the proposed integration and preferred architecture would be appreciated before proceeding.

But of course sticking to custom pre-processing step also works. It just seems like such a natural fit, hence the proposal.

Ngôn ngữ chính
Java
Star
26.9k
Fork
7.8k
Merge trung bình
2 ngày 23 phút
Pull request đã merge (30 ngày)
177

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenAPITools/openapi-generator

Tất cả issue của OpenAPITools/openapi-generator

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.