TestSchemaForMessage_CycleSafe — google.protobuf.Value references itself via repeated Value (ListValue.values). Before the cycle-guard fix, exposing any tool whose request includes a Struct or Value field would stack-overflow at boot. The visited-set short-circuits and emits an opaque `object`.
(t *testing.T)
| 48 | // any tool whose request includes a Struct or Value field would stack-overflow |
| 49 | // at boot. The visited-set short-circuits and emits an opaque `object`. |
| 50 | func TestSchemaForMessage_CycleSafe(t *testing.T) { |
| 51 | // AppData wraps google.protobuf.Struct, which contains a |
| 52 | // map<string, Value>, where Value can hold a ListValue of more Values. |
| 53 | // That's the exact recursion that would stack-overflow without the guard. |
| 54 | app := (&authorizerv1.SignupRequest{}).ProtoReflect().Descriptor().Fields().ByName("app_data") |
| 55 | require.NotNil(t, app) |
| 56 | |
| 57 | schema := schemaForField(app, map[protoreflect.FullName]struct{}{}) |
| 58 | // Doesn't panic / overflow. The deeply-nested Value type collapses to |
| 59 | // an opaque object once the cycle is detected. |
| 60 | assert.Equal(t, "object", schema.Type) |
| 61 | } |
| 62 | |
| 63 | // TestSchemaForMessage_ScalarOnly walks a request that's purely scalars |
| 64 | // (no nested message). Profile takes no arguments at all; Session takes |
nothing calls this directly
no test coverage detected