Skip to content

include the array schema in the tuple-like array panic - #1770

Open
mliemm wants to merge 1 commit into
oxidecomputer:mainfrom
mliemm:fix/log-tuple-array-schema
Open

mliemm wants to merge 1 commit into
oxidecomputer:mainfrom
mliemm:fix/log-tuple-array-schema

Conversation

@mliemm

@mliemm mliemm commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1381.

j2oas_array panics with OpenAPI v3.0.x cannot support tuple-like arrays but doesn't say which schema caused it, so finding the offending type in a large API means bisecting. The panic message now ends with the array schema as JSON. For example, a (bool, String) field gives:

OpenAPI v3.0.x cannot support tuple-like arrays: {"items":[{"type":"boolean"},{"type":"string"}],"maxItems":2,"minItems":2}

If the schema can't be serialized, the message falls back to its Debug form. Apart from the message, nothing changes: a tuple-like array still panics.

Testing

  1. Added test_tuple_array_panic_shows_schema, a #[should_panic(expected = ...)] test that checks the full message for (bool, String). It fails with "panic did not contain expected string" when the old message is restored.
  2. cargo fmt -- --check and cargo clippy --all-targets -- --deny warnings are clean.
  3. cargo test -p dropshot passes: 144 unit tests, 101 integration tests and the doc tests.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 13:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@david-crespo

Copy link
Copy Markdown
Contributor

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

@mliemm

mliemm commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

The failing pagination tests here come from Rust 1.100 changing where Cargo puts test binaries, not from this change; the same assertion fails on any PR built with stable. #1771 fixes the test.

The panic for a tuple-like array schema did not say which schema caused
it, which makes the offending type hard to find in a large API. The
message now ends with the array schema as JSON, for example
`{"items":[{"type":"boolean"},{"type":"string"}],"maxItems":2,"minItems":2}`.

Fixes oxidecomputer#1381
@mliemm
mliemm force-pushed the fix/log-tuple-array-schema branch from a5f4795 to dcb29a6 Compare November 19, 2026 07:37
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.

Log bad array on cannot support tuple-like arrays error

4 participants