api: fromjson/tojson enum flag support

Represent enum flags as JSON arrays (as these can have multiple values).
Add unit tests.

Type: improvement
Change-Id: I680c5b6f76ef6f05f360e2f3b9c4cbb927e15d7d
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/vat2/CMakeLists.txt b/src/vat2/CMakeLists.txt
index 690267c..73538b4 100644
--- a/src/vat2/CMakeLists.txt
+++ b/src/vat2/CMakeLists.txt
@@ -31,6 +31,29 @@
   rt m dl crypto
 )
 
+#
+# Unit test code. Call generator directly to avoid it being installed
+#set_source_files_properties(vat2_test.c PROPERTIES
+#  COMPILE_FLAGS " -fsanitize=address"
+#)
+
+vpp_generate_api_c_header (test/vat2_test.api)
+add_vpp_executable(test_vat2 ENABLE_EXPORTS NO_INSTALL
+  SOURCES
+  test/vat2_test.c
+  jsonconvert.c
+
+  DEPENDS api_headers
+
+  LINK_LIBRARIES
+  vlibmemoryclient
+  svm
+  vppinfra
+  vppapiclient
+  Threads::Threads
+  rt m dl crypto
+)
+#target_link_options(test_vat2 PUBLIC "LINKER:-fsanitize=address")
 ##############################################################################
 # vat2 headers
 ##############################################################################