Skip to content

feat: support $refs - #3

Merged
dotkas merged 3 commits into
mainfrom
dotkas/on-par-continued
Jun 25, 2026
Merged

feat: support $refs#3
dotkas merged 3 commits into
mainfrom
dotkas/on-par-continued

Conversation

@dotkas

@dotkas dotkas commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via import-mapping.
  • Add RustType::External and emission support for module::Type references.
  • Introduce a new server_refs fixture 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.

Comment thread crates/oapi-codegen/src/emit.rs Outdated
Comment thread crates/oapi-codegen/src/loader.rs
Comment thread crates/oapi-codegen/src/paths.rs
Comment thread crates/oapi-codegen/src/paths.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread crates/oapi-codegen/src/loader.rs Outdated
Comment thread crates/oapi-codegen/src/loader.rs Outdated
@dotkas
dotkas force-pushed the dotkas/on-par-continued branch from 623220a to ca769c3 Compare June 25, 2026 17:36
@dotkas
dotkas requested a review from Copilot June 25, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread crates/oapi-codegen/src/paths.rs
Comment thread crates/oapi-codegen/src/paths.rs
@dotkas
dotkas force-pushed the dotkas/on-par-continued branch from ca769c3 to 1522d0d Compare June 25, 2026 17:51
@dotkas
dotkas enabled auto-merge (squash) June 25, 2026 17:52
@dotkas
dotkas disabled auto-merge June 25, 2026 17:53
@dotkas
dotkas merged commit b51fb0a into main Jun 25, 2026
4 checks passed
@dotkas
dotkas deleted the dotkas/on-par-continued branch June 25, 2026 17:54
@dotkas dotkas removed the released label Jul 16, 2026
@alchemaxinc alchemaxinc deleted a comment from alchemax-housekeeper Bot Jul 16, 2026
@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0-dev.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants