Skip to content

feat: no silent drops - #132

Merged
dotkas merged 2 commits into
developfrom
dotkas/oapi-no-silent-drops
Sep 6, 2026
Merged

dotkas merged 2 commits into
developfrom
dotkas/oapi-no-silent-drops

Conversation

@dotkas

@dotkas dotkas commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #97

Copilot AI lite review requested due to automatic review settings September 6, 2026 15:10

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.

🟡 Changes recommended

The new $ref-sibling warning is skipped for PathItem contexts, which can leave ignored PathItem sibling keys without the intended “no silent drops” diagnostic.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR tightens generator diagnostics to avoid silently dropping spec/config content by adding pre-deserialization key/shape inspection, plus targeted runtime warnings for currently-ignored but valid OpenAPI features and translation limits.

Changes:

  • Add an OpenAPI key/shape inspection pass (coverage) invoked by the loader for root and referenced documents, producing aggregated InvalidSpec errors and warnings.
  • Add YAML config unknown-key diagnostics by comparing the input YAML tree against Config::default()’s serialized shape, emitting warnings while keeping parse errors unchanged.
  • Expand lowering-time warnings for unsupported/ignored operation details (media-type selection, scalar parameter enum ignored, non-default parameter styles) and document the new behavior.
File summaries
File Description
README.md Updates the high-level behavior note to reflect “warn then ignore” for unknown config keys.
docs/design.md Documents the new inspection/diagnostics model (errors vs warnings, pointers, referenced docs).
docs/configuration.md Clarifies config compatibility: unknown keys warn (including nested sections) while invalid known values still error.
crates/oapi-codegen/tests/diagnostics_operations.rs Adds integration tests asserting warnings don’t change generated output for various operation-level cases.
crates/oapi-codegen/tests/check_mode.rs Adds tests for config unknown-key warnings, spec unknown-key failures, referenced-doc diagnostics, and JSON entry points.
crates/oapi-codegen/src/lower/schema.rs Emits a warning when an Any schema is non-empty but must fall back to serde_json::Value.
crates/oapi-codegen/src/lower/paths.rs Adds warnings for unsupported parameter styles, ignored scalar enums, and discarded/unsupported media types (including referenced origins).
crates/oapi-codegen/src/loader.rs Invokes the new coverage::check on root and referenced documents before typed deserialization.
crates/oapi-codegen/src/lib.rs Wires new internal modules (coverage, diagnostic) into the crate.
crates/oapi-codegen/src/error.rs Introduces Error::InvalidSpec for unknown keys/invalid shapes and integrates it into Display/source.
crates/oapi-codegen/src/diagnostic.rs Adds shared warning formatting and JSON-pointer escaping utility.
crates/oapi-codegen/src/coverage.rs Implements the OpenAPI key catalogue, traversal, warning emission, and aggregated invalid-spec reporting.
crates/oapi-codegen/src/console.rs Adds a CLI hint for InvalidSpec errors.
crates/oapi-codegen/src/config.rs Adds config unknown-key warnings via untyped YAML inspection against the default serialized shape.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/oapi-codegen/src/coverage.rs
Copilot AI review requested due to automatic review settings September 6, 2026 18:19
@dotkas
dotkas enabled auto-merge (squash) September 6, 2026 18:20
@dotkas
dotkas merged commit 6c88be5 into develop Sep 6, 2026
7 of 8 checks passed
@dotkas
dotkas deleted the dotkas/oapi-no-silent-drops branch September 6, 2026 18:21
@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

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

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.3.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.

Validate that nothing gets silently dropped

2 participants