feat: support $refs - #3
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds server-generator support for additional OpenAPI $ref scenarios: resolving component-level response $refs within the same document and routing cross-file schema $refs through import-mapping, with new fixtures/tests to ensure generated servers still compile.
Changes:
- Extend server path lowering to resolve component response
$refs and map cross-file schema$refs to external Rust paths viaimport-mapping. - Add
RustType::Externaland emission support formodule::Typereferences. - Introduce a new
server_refsfixture plus compile tests and coverage registration.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oapi-codegen/tests/generated/server_refs.rs | New generated server fixture exercising component response $ref + cross-file schema $ref. |
| crates/oapi-codegen/tests/generated_compiles.rs | Includes the new fixture and adds a compile-time test + stand-in apimodel module for import-mapping. |
| crates/oapi-codegen/tests/fixtures/server_refs.yaml | New OpenAPI fixture covering cross-file request body $ref and component response $ref. |
| crates/oapi-codegen/tests/coverage.rs | Registers server_refs and configures import_mapping for server fixture tests. |
| crates/oapi-codegen/src/paths.rs | Refactors lowering into a Lowerer and adds cross-file schema $ref handling + component response $ref resolution. |
| crates/oapi-codegen/src/loader.rs | Adds Spec::resolve_response and new $ref parsing helpers (ref_component_name, ref_file_part). |
| crates/oapi-codegen/src/lib.rs | Wires Config::import_mapping into server service generation. |
| crates/oapi-codegen/src/ir.rs | Adds RustType::External for import-mapped types. |
| crates/oapi-codegen/src/emit.rs | Emits RustType::External as module::Type. |
dotkas
force-pushed
the
dotkas/on-par-continued
branch
from
June 25, 2026 17:36
623220a to
ca769c3
Compare
dotkas
force-pushed
the
dotkas/on-par-continued
branch
from
June 25, 2026 17:51
ca769c3 to
1522d0d
Compare
dotkas
enabled auto-merge (squash)
June 25, 2026 17:52
dotkas
disabled auto-merge
June 25, 2026 17:53
Contributor
|
🎉 This PR is included in version 1.0.0-dev.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.