Add µEd OpenAPI validation middleware#17
Open
m-messer wants to merge 5 commits into
Open
Conversation
…penAPI specification
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Relocates the spec from api/ into runtime/schema/ alongside the existing JSON schema files, and renames it to mued_v0.1.0.yml to make the version explicit. Removes the api/ package; embed is now owned by runtime/schema. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously, responses that failed spec validation were only logged as warnings and forwarded anyway. Now a failed µEd response validation returns 500 to the caller. The legacy / route is unaffected — it has no matching path in the spec so the middleware passes it through unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
runtime/schema/mued_v0.1.0.yml) into the binarykin-openapimiddleware (internal/server/openapi.go) that validates all µEd route traffic against the spec at the HTTP layer, wired into the server chain viafxafterNormalizePathHow validation is layered
The legacy
/route has no matching path in the spec so the middleware passes it through entirely unchanged, including the raw worker response body. The existinggojsonschemavalidation of the legacy worker protocol insideRuntimeHandleris also unchanged.mued_v0.1.0.ymlRuntimeHandlergojsonschema (existing)/{response, answer, params}worker protocolrequest-eval.jsonetc.Test plan
go build ./...passesgo test ./...passesPOST /evaluatewith missingsubmissionfield returns 400POST /evaluatewith a valid µEd body reaches the worker as beforeGET /evaluate/healthcontinues to workPOST /(legacy route) bypasses the OpenAPI validator and returns the raw worker response unchanged🤖 Generated with Claude Code