From b9fb58bba50207256485e9b58c9e45d10b855c21 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 13 Mar 2023 11:39:21 -0700 Subject: [PATCH] Emit upbdev JSON using numeric representation for enums. PiperOrigin-RevId: 516273336 --- upbc/upbdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upbc/upbdev.c b/upbc/upbdev.c index f41d38f00f..c3a205a2c5 100644 --- a/upbc/upbdev.c +++ b/upbc/upbdev.c @@ -59,13 +59,14 @@ static upb_StringView upbc_JsonEncode(const upbc_CodeGeneratorRequest* request, upb_DefPool* s = upb_DefPool_New(); const upb_MessageDef* m = upbc_CodeGeneratorRequest_getmsgdef(s); + const int options = upb_JsonEncode_FormatEnumsAsIntegers; - out.size = upb_JsonEncode(request, m, s, 0, NULL, 0, status); + out.size = upb_JsonEncode(request, m, s, options, NULL, 0, status); if (!upb_Status_IsOk(status)) goto done; char* data = (char*)upb_Arena_Malloc(arena, out.size + 1); - (void)upb_JsonEncode(request, m, s, 0, data, out.size + 1, status); + (void)upb_JsonEncode(request, m, s, options, data, out.size + 1, status); if (!upb_Status_IsOk(status)) goto done; out.data = (const char*)data;