Azure Function OpenAPI - Error same key has already been added

Viewed 538

I have a problem implementing OpenAPI in an Azure Function.

I am using the following package

Microsoft.Azure.WebJobs.Expensions.OpenApi

This is the error:

An item with the same key has already been added. Key: result_list`1

The cause is because I have several functions that are returning the same type CustomCollection<T>

How could you implement a solution for this issue?

1 Answers
  1. Before inserting a data into a custom generic collection (CustomCollection<T>) try to remove/delete previous values or after got a values from function remove/delete the values in a CustomCollection<T>. This can helps to avoid conflict.

  2. Try to use multiple CustomCollection<T> with different names can solve the problem.

  3. Add a key value with some prefix or suffix characters while inserting.

Eg: Actual Key : result_list you can use as result_list_fun1 or fun1_result_list

Related