Skip to content

Conversation

@simone-stacks
Copy link
Contributor

@simone-stacks simone-stacks commented Dec 11, 2025

Description

Improves OpenAPI schema definitions for better API documentation accuracy and validation.

Also introduces proper 405/404/400 HTTP error responses with allow headers.

These changes improve schema accuracy for tools like Schemathesis and ensure the OpenAPI spec matches actual API behavior.

A summary of the findings can be found here.

Applicable issues

Additional info (benefits, drawbacks, caveats)

Benefits:

  • More accurate API documentation
  • Better client code generation from OpenAPI spec
  • Enables automated API testing with Schemathesis
  • Clearer error responses for API consumers:
    • 400 for invalid path parameters (e.g. /v3/blocks/NOTAHEX) - previously returned 404
    • 404 for paths that don't exist
    • 405 with Allow header for wrong HTTP methods - helps clients discover correct methods
  • The 400 approach tells consumers "you found the right endpoint, fix your parameter" rather than "this doesn't exist"

Caveats:

  • Stricter schemas may flag previously "working" requests that were technically invalid
  • Some endpoints with complex parameter patterns (contract names, principals) still return 404 for invalid params instead of 400 - this matches previous behavior

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo

@simone-stacks simone-stacks changed the title chore: OpenAPI spec cleanup for nightly Schemathesis fuzzing chore: openapi spec cleanup for nightly schemathesis fuzzing Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 47.91667% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.45%. Comparing base (e156f8d) to head (efb8fc8).

Files with missing lines Patch % Lines
stackslib/src/net/httpcore.rs 63.46% 38 Missing ⚠️
stackslib/src/net/http/error.rs 0.00% 32 Missing ⚠️
stackslib/src/net/http/mod.rs 0.00% 5 Missing ⚠️

❌ Your project check has failed because the head coverage (71.45%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6756      +/-   ##
===========================================
+ Coverage    68.57%   71.45%   +2.87%     
===========================================
  Files          582      582              
  Lines       361458   361573     +115     
===========================================
+ Hits        247879   258348   +10469     
+ Misses      113579   103225   -10354     
Files with missing lines Coverage Δ
stackslib/src/net/http/request.rs 81.97% <100.00%> (-0.12%) ⬇️
stackslib/src/net/http/mod.rs 49.51% <0.00%> (-2.53%) ⬇️
stackslib/src/net/http/error.rs 34.12% <0.00%> (-8.69%) ⬇️
stackslib/src/net/httpcore.rs 80.40% <63.46%> (-1.91%) ⬇️

... and 379 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e156f8d...efb8fc8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simone-stacks

This comment was marked as outdated.

Copy link
Contributor

@BowTiedRadone BowTiedRadone left a comment

Choose a reason for hiding this comment

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

@simone-stacks Thanks for opening the PR! I've just wrapped up an initial review focused on the specification changes. More reviews to come, as I am trying to check them carefully and ensure we maximize the impact of this effort.

@simone-stacks simone-stacks changed the title chore: openapi spec cleanup for nightly schemathesis fuzzing feature: openapi spec cleanup for schemathesis fuzzing and cleaner API error responses Dec 16, 2025
@simone-stacks simone-stacks changed the title feature: openapi spec cleanup for schemathesis fuzzing and cleaner API error responses feat: openapi spec cleanup for schemathesis fuzzing and cleaner API error responses Dec 16, 2025
Copy link
Contributor

@BowTiedRadone BowTiedRadone left a comment

Choose a reason for hiding this comment

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

This PR is in a great spot now! After checking the last two suggestions I left, I believe it's ready to be taken out of draft and get some more eyes on it.

@simone-stacks simone-stacks marked this pull request as ready for review December 19, 2025 10:54
@simone-stacks simone-stacks requested review from a team and BowTiedRadone December 19, 2025 18:19
Copy link
Contributor

@BowTiedRadone BowTiedRadone left a comment

Choose a reason for hiding this comment

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

Checked again, this looks ready for reviews from reviewers with write access 👍

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