Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPErrorHandler ¶
func NewHTTPErrorHandler() echo.HTTPErrorHandler
NewHTTPErrorHandler returns a custom echo.HTTPErrorHandler that renders framework-level errors (404, 405, etc.) in the unified ErrorResponse format.
Types ¶
type ErrorCode ¶
type ErrorCode string
ErrorCode is a typed string for structured error codes.
const ( CodeInvalidRequestBody ErrorCode = "INVALID_REQUEST_BODY" CodeValidationError ErrorCode = "VALIDATION_ERROR" CodeInternalError ErrorCode = "INTERNAL_ERROR" CodeTimeout ErrorCode = "TIMEOUT" CodeNotFound ErrorCode = "NOT_FOUND" CodeMethodNotAllowed ErrorCode = "METHOD_NOT_ALLOWED" CodeRequestBodyTooLarge ErrorCode = "REQUEST_BODY_TOO_LARGE" CodeServerBusy ErrorCode = "SERVER_BUSY" )
type ErrorResponse ¶
type ErrorResponse struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Errors []ValidationError `json:"errors,omitempty"`
}
ErrorResponse is the unified JSON error response body.
type File ¶
type File struct {
Name *string `json:"name"`
Content *string `json:"content"`
Base64Encoded bool `json:"base64_encoded"`
}
File represents a single source file in the run request. The first file in the request's Files array is used as the entrypoint.
type Handler ¶
type Handler struct {
Runner *sandbox.Runner
MaxFiles int
MaxFileSize int
// MaxStdinSize bounds the post-decode stdin length in bytes. For
// base64-encoded stdin this is the decoded byte count, not the wire
// string length. The raw request body is independently bounded by
// Echo's BodyLimit middleware configured at server startup; if
// MaxStdinSize exceeds the body limit, the body limit wins.
MaxStdinSize int
}
Handler holds dependencies for the HTTP handler.
type RunRequest ¶
type RunRequest struct {
Runtime *string `json:"runtime"`
Files []File `json:"files"`
Stdin *StdinInput `json:"stdin"`
}
RunRequest is the JSON request body for POST /v1/run.
type RunResponse ¶
type RunResponse struct {
Compile *sandbox.Result `json:"compile"`
Run *sandbox.Result `json:"run"`
}
RunResponse is the JSON response for POST /v1/run. Compile is nil for interpreted runtimes. Run is nil when compilation fails.
type StdinInput ¶ added in v0.9.0
type StdinInput struct {
Content *string `json:"content"`
Base64Encoded bool `json:"base64_encoded"`
}
StdinInput represents the optional stdin payload in a run request. The payload is delivered only to the run-step child process; compile-step children never receive stdin. When the top-level "stdin" field is omitted, the RunRequest.Stdin pointer is nil. When present, Content is required: a nil Content (e.g. JSON `"stdin": {}`) produces a `required` validation error. When Base64Encoded is true, Content is interpreted as a base64-encoded string and decoded server-side; when false (the default), the raw bytes of Content are forwarded to the run-step child's stdin directly.
type ValidationError ¶
ValidationError describes a field-level validation failure.