Microsoft Entra Suite Tech Accelerator
Aug 14 2024, 07:00 AM - 09:30 AM (PDT)
Microsoft Tech Community

Generated .NET API for JsonAtlasGlossaryTerm not entirely correct

Copper Contributor

We are experimenting with the API and when executing GlossaryREST.GetGlossaryTermsWithHttpMessagesAsync to retrieve glossary terms we have defined, that worked fine until we added a contact to one of the terms. Then it failed with: 

Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'PurviewCatalog.Models.JsonContactBasic' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath


Turns out that in:

JsonAtlasGlossaryTerm => defines contacts, which was defined as: public IDictionary<string, JsonContactBasic>
This must be however: public IDictionary<string, ILIst<JsonContactBasic>>
and with that the associated changes in the call to the constructor for JsonAtlasGlossaryTerm


0 Replies