package wireschema import ( "amadan.net/oficina/equipo/internal/wire" "encoding/json" "testing" ) func TestNotificationOperationSchemas(t *testing.T) { if _, ok := Ops["POST /tasks/{id}/retry"].In.(wire.RetryTask); !ok { t.Fatal("retry binding is undocumented") } var answer map[string]any if err := json.Unmarshal(Body(Ops["POST /cards/{id}/answer"].Out["409"]), &answer); err != nil { t.Fatal(err) } alternatives, ok := answer["oneOf"].([]any) if !ok || len(alternatives) != 2 { t.Fatal("card and idempotency conflicts must both be documented", answer) } want := map[string]bool{"#/components/schemas/CardConflict": true, "#/components/schemas/Error": true} for _, entry := range alternatives { delete(want, entry.(map[string]any)["$ref"].(string)) } if len(want) != 0 { t.Fatal(want) } raw := Generate()["RegisterPush"] var registration map[string]any if err := json.Unmarshal(raw, ®istration); err != nil { t.Fatal(err) } properties := registration["properties"].(map[string]any) for _, key := range []string{"binding_id", "actions_version"} { if properties[key] == nil { t.Fatal(key) } } }