RFC 9457 Problem Details JSON parser, serializer, validator, registry and audit toolkit for MoonBit.
moon check --target wasm-gc
moon run ./examples/parse --target wasm-gcpython ./scripts/verify_iana_snapshot.pymoon run ./cmd/problem-tool -- parse --input '{"status":404}'
moon run ./cmd/problem-tool -- validate --status 404 --input '{"status":404}'
moon run ./cmd/problem-tool -- registry about:blank
moon run ./cmd/problem-tool -- make --status 404 --title "Not Found"moon run ./cmd/problem-tool -- parse --input '{"title":123,"status":404,"request_id":"abc"}'.\scripts\verify_all.ps1pub struct AuditIssue {
kind : AuditIssueKind
severity : AuditSeverity
context : String
} derive(Eq, Debug)pub struct ProblemBuilder {
type_raw : String?
title : String?
status : Int?
detail : String?
instance : String?
extensions : Array[ExtensionMember]
error : ProblemError?
}pub struct ProblemDetails {
type_raw : String?
title : String?
status : Int?
detail : String?
instance : String?
extensions : Array[ExtensionMember]
} derive(Eq, Debug)pub struct ProblemDiagnostic {
kind : ProblemDiagnosticKind
member_name : String
expected : String
actual : String
} derive(Eq, Debug)pub struct ProblemParseResult {
problem : ProblemDetails
diagnostics : Array[ProblemDiagnostic]
} derive(Eq, Debug)fn parse_problem_json_bytes(input : Bytes, limits? : Limits) -> Result[ProblemParseResult, ProblemError]fn parse_problem_json_with_limits(input : String, limits : Limits) -> Result[ProblemParseResult, ProblemError]fn problem_context(actual_status : Int?, content_type : String?, base_uri : String?) -> ProblemContextfn problem_details(type_raw : String?, title : String?, status : Int?, detail : String?, instance : String?, extensions : Array[ExtensionMember]) -> ProblemDetailsfn problem_error(stage : ProblemErrorStage, kind : ProblemErrorKind, context : String, byte_offset? : Int) -> ProblemErrorfn problem_type_record(type_uri : String, title : String, recommended_status : Int?, reference : String) -> ProblemTypeRecordfn status_reason(code : Int) -> String?RFC 9457 Problem Details JSON parser, serializer, validator, registry and audit toolkit for MoonBit.