Skip to content

feat(0.9.0): generics-aware generation, shared contract reuse, and end-to-end consumer validation#17

Merged
bsayli merged 14 commits intomainfrom
architecture/domain-contracts
Apr 12, 2026
Merged

feat(0.9.0): generics-aware generation, shared contract reuse, and end-to-end consumer validation#17
bsayli merged 14 commits intomainfrom
architecture/domain-contracts

Conversation

@bsayli
Copy link
Copy Markdown
Collaborator

@bsayli bsayli commented Apr 12, 2026

🧩 Pull Request Template

Thank you for contributing to openapi-generics! 🙌
This repository is contract‑first, projection‑driven, and generator‑sensitive — small changes can affect:

  • Contract semantics
  • OpenAPI projection output
  • Generated client behavior
  • Long-term determinism guarantees

This template is intentionally strict. It ensures reviewers evaluate contract impact first, implementation second.


🚀 0.9.0 Release

This release formalizes the architecture that has been taking shape:

  • Contract-first generation is now explicit and enforced
  • External contract reuse (BYOC) is now a first-class feature
  • The full pipeline is proven end-to-end with real consumer modules

Spring Boot 3 and 4 are both validated. The architecture is no longer a concept — it runs.


🎯 Summary

What does this PR change and why?

Enforces explicit, contract-aligned client generation and validates the full contract → OpenAPI → client → consumer pipeline with real usage. This removes implicit generation behavior, stabilizes external contract reuse, and proves deterministic end-to-end alignment across Spring Boot 3 and 4.


📦 Changes

  • Explicit generator activation

    • require generatorName=java-generics-contract
    • remove implicit activation from parent configuration
  • External contract reuse (BYOC support)

    • introduce openapiGenerics.responseContract.* mapping
    • enable reuse of externally owned DTOs (no generation)
    • ensure correct import injection in generated wrappers
  • Codegen refactoring (behavior isolation)

    • extract ExternalModelRegistry
    • extract ModelIgnoreDecider
    • extract ExternalImportResolver
    • simplify GenericAwareJavaCodegen to orchestration only
  • Spring Boot 4 client support

    • RestClient-based client generation
    • Jackson 3 compatibility
    • fix compile-time issues in SB4 client
  • Consumer module (NEW)

    • add customer-service-consumer (SB3 & SB4)
    • demonstrate real client usage
    • validate full pipeline integration
    • add service + controller + integration tests
  • CI / coverage updates

    • scope coverage to samples only
    • adjust baseline to 50%
    • update workflows for sb3 / sb4 sample structure
  • Documentation updates

    • align client adoption guide with explicit configuration model
    • correct minimal setup
    • clarify generator usage and contract reuse

🧠 Outcome / Impact

  • Makes client generation explicit and predictable
  • Ensures external contract models are reused (no duplication)
  • Improves determinism and debuggability of generation
  • Validates architecture with real consumer integration
  • Aligns documentation with actual system behavior
  • Stabilizes CI against real multi-module structure

🔐 Contract Awareness

Contract impact: yes

Affected:

  • Generator behavior (contract reuse enforcement)
  • Generated client structure (wrapper + imports)

Not affected:

  • Canonical contract types (ServiceResponse<T>, Page<T>, Meta)
  • OpenAPI projection semantics

🌍 Multi‑Language Considerations

  • Changes are Java generator specific
  • Vendor extensions remain safe / no-op for non-Java generators
  • Reduces duplication risk across generators via ignore semantics

🧱 Affected Layer

  • Contract (openapi-generics-contract)
  • Projection (openapi-generics-server-starter)
  • Generator (openapi-generics-java-codegen)
  • Generator Parent (openapi-generics-java-codegen-parent)
  • Build / CI
  • Documentation

🔄 Dependency Path Impact

Client path:

codegen-parent → codegen → contract

Now requires explicit generator selection and enforces contract reuse.


✅ Checklist

  • Scope is minimal and focused
  • Build passes: mvn -q -ntp clean verify
  • Tests added/updated
  • Docs updated
  • Contract impact evaluated
  • No direct edits to generated code
  • Changes applied at correct layer

🧾 Metadata

  • Type: feature / refactor / docs / ci / test
  • Target Release: 0.9.0

💡 Review Tips

  • Verify explicit generator activation
  • Verify no duplicated contract models
  • Validate consumer module as proof of correctness

Core principle:

Contracts are defined at generation time — not corrected downstream.

bsayli added 13 commits April 11, 2026 16:39
… handling

- extract ExternalModelRegistry for external contract mapping
- extract ModelIgnoreDecider for ignore rules
- extract ExternalImportResolver for import injection
- simplify GenericAwareJavaCodegen to orchestration only
- preserve behavior: no model duplication, correct import injection

ensures contract-first generation with external model reuse
…d usage

- remove obsolete CustomerDeleteResponse usage
- fix Spring Boot 4 client compile-time issues
- update adapter and API usage to match ServiceResponse contract
- apply import optimizations

ensures consistency with contract-first model and generated client
- require explicit generatorName=java-generics-contract
- remove implicit activation from parent configuration
- add debug logs for registry, ignore decision and import resolution
- ensure template directory exists before patching

improves predictability, debuggability and explicit adoption of generics codegen
- advance version for ongoing feature development
- add customer-service-consumer to demonstrate client usage
- validate end-to-end contract → client → consumer flow
- introduce server-openapi-projection.md
- introduce client-code-generation.md
- introduce customer-service-consumer layer
- add service, client and controller integration structure
- add unit tests for consumer services, mappers and exception handling
- include core pipeline tests for openapi generics (introspector, schemas, processor, orchestrator)
…, deterministic pipeline)

- unify docs around SSOT contract → projection → generation model
- remove outdated or misleading concepts (template tweak, OpenAPI authority, etc.)
- clarify server as deterministic projection engine (runtime → OpenAPI)
- clarify client as contract-aligned generation layer (OpenAPI → Java)
- position generator as enforcement layer (not customization)
- separate architecture vs usage concerns (BYOC moved out of core architecture)
- ensure consistency across README, architecture, and module docs
- reflect supported scope and invariants explicitly
- improve clarity, terminology, and mental model across all modules
- lower coverage target to 50% after consumer module addition
- adjust threshold to reduce noise in CI
- keep coverage scoped to samples only
- update build and CodeQL workflows for new sample structure (sb3/sb4)
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 24.24242% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...onsumer/config/version/ApiOnlyVersionResolver.java 0.00% 13 Missing ⚠️
...rvice/client/adapter/mapper/CustomerDtoMapper.java 0.00% 7 Missing ⚠️
...service/config/version/ApiOnlyVersionResolver.java 61.53% 2 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@bsayli bsayli merged commit c691e06 into main Apr 12, 2026
3 checks passed
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.

2 participants