Coverage Report

Created: 2026-09-28 06:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/sbi/openapi/model/rule_set.c
Line
Count
Source
1
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdio.h>
5
#include "rule_set.h"
6
7
OpenAPI_rule_set_t *OpenAPI_rule_set_create(
8
    int priority,
9
    OpenAPI_list_t *plmns,
10
    OpenAPI_list_t *snpns,
11
    OpenAPI_list_t *nf_types,
12
    OpenAPI_list_t *nf_domains,
13
    OpenAPI_list_t *nssais,
14
    OpenAPI_list_t *nf_instances,
15
    OpenAPI_list_t *scopes,
16
    OpenAPI_rule_set_action_e action
17
)
18
2.18k
{
19
2.18k
    OpenAPI_rule_set_t *rule_set_local_var = ogs_malloc(sizeof(OpenAPI_rule_set_t));
20
2.18k
    ogs_assert(rule_set_local_var);
21
22
2.18k
    rule_set_local_var->priority = priority;
23
2.18k
    rule_set_local_var->plmns = plmns;
24
2.18k
    rule_set_local_var->snpns = snpns;
25
2.18k
    rule_set_local_var->nf_types = nf_types;
26
2.18k
    rule_set_local_var->nf_domains = nf_domains;
27
2.18k
    rule_set_local_var->nssais = nssais;
28
2.18k
    rule_set_local_var->nf_instances = nf_instances;
29
2.18k
    rule_set_local_var->scopes = scopes;
30
2.18k
    rule_set_local_var->action = action;
31
32
2.18k
    return rule_set_local_var;
33
2.18k
}
34
35
void OpenAPI_rule_set_free(OpenAPI_rule_set_t *rule_set)
36
11.6k
{
37
11.6k
    OpenAPI_lnode_t *node = NULL;
38
39
11.6k
    if (NULL == rule_set) {
40
9.51k
        return;
41
9.51k
    }
42
2.18k
    if (rule_set->plmns) {
43
211
        OpenAPI_list_for_each(rule_set->plmns, node) {
44
0
            OpenAPI_plmn_id_free(node->data);
45
0
        }
46
211
        OpenAPI_list_free(rule_set->plmns);
47
211
        rule_set->plmns = NULL;
48
211
    }
49
2.18k
    if (rule_set->snpns) {
50
194
        OpenAPI_list_for_each(rule_set->snpns, node) {
51
0
            OpenAPI_plmn_id_nid_free(node->data);
52
0
        }
53
194
        OpenAPI_list_free(rule_set->snpns);
54
194
        rule_set->snpns = NULL;
55
194
    }
56
2.18k
    if (rule_set->nf_types) {
57
220
        OpenAPI_list_free(rule_set->nf_types);
58
220
        rule_set->nf_types = NULL;
59
220
    }
60
2.18k
    if (rule_set->nf_domains) {
61
268
        OpenAPI_list_for_each(rule_set->nf_domains, node) {
62
268
            ogs_free(node->data);
63
268
        }
64
268
        OpenAPI_list_free(rule_set->nf_domains);
65
268
        rule_set->nf_domains = NULL;
66
268
    }
67
2.18k
    if (rule_set->nssais) {
68
267
        OpenAPI_list_for_each(rule_set->nssais, node) {
69
139
            OpenAPI_ext_snssai_free(node->data);
70
139
        }
71
267
        OpenAPI_list_free(rule_set->nssais);
72
267
        rule_set->nssais = NULL;
73
267
    }
74
2.18k
    if (rule_set->nf_instances) {
75
440
        OpenAPI_list_for_each(rule_set->nf_instances, node) {
76
294
            ogs_free(node->data);
77
294
        }
78
440
        OpenAPI_list_free(rule_set->nf_instances);
79
440
        rule_set->nf_instances = NULL;
80
440
    }
81
2.18k
    if (rule_set->scopes) {
82
286
        OpenAPI_list_for_each(rule_set->scopes, node) {
83
286
            ogs_free(node->data);
84
286
        }
85
268
        OpenAPI_list_free(rule_set->scopes);
86
268
        rule_set->scopes = NULL;
87
268
    }
88
2.18k
    ogs_free(rule_set);
89
2.18k
}
90
91
cJSON *OpenAPI_rule_set_convertToJSON(OpenAPI_rule_set_t *rule_set)
92
0
{
93
0
    cJSON *item = NULL;
94
0
    OpenAPI_lnode_t *node = NULL;
95
96
0
    if (rule_set == NULL) {
97
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [RuleSet]");
98
0
        return NULL;
99
0
    }
100
101
0
    item = cJSON_CreateObject();
102
0
    if (cJSON_AddNumberToObject(item, "priority", rule_set->priority) == NULL) {
103
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [priority]");
104
0
        goto end;
105
0
    }
106
107
0
    if (rule_set->plmns) {
108
0
    cJSON *plmnsList = cJSON_AddArrayToObject(item, "plmns");
109
0
    if (plmnsList == NULL) {
110
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [plmns]");
111
0
        goto end;
112
0
    }
113
0
    OpenAPI_list_for_each(rule_set->plmns, node) {
114
0
        cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data);
115
0
        if (itemLocal == NULL) {
116
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [plmns]");
117
0
            goto end;
118
0
        }
119
0
        cJSON_AddItemToArray(plmnsList, itemLocal);
120
0
    }
121
0
    }
122
123
0
    if (rule_set->snpns) {
124
0
    cJSON *snpnsList = cJSON_AddArrayToObject(item, "snpns");
125
0
    if (snpnsList == NULL) {
126
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [snpns]");
127
0
        goto end;
128
0
    }
129
0
    OpenAPI_list_for_each(rule_set->snpns, node) {
130
0
        cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data);
131
0
        if (itemLocal == NULL) {
132
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [snpns]");
133
0
            goto end;
134
0
        }
135
0
        cJSON_AddItemToArray(snpnsList, itemLocal);
136
0
    }
137
0
    }
138
139
0
    if (rule_set->nf_types != OpenAPI_nf_type_NULL) {
140
0
    cJSON *nf_typesList = cJSON_AddArrayToObject(item, "nfTypes");
141
0
    if (nf_typesList == NULL) {
142
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_types]");
143
0
        goto end;
144
0
    }
145
0
    OpenAPI_list_for_each(rule_set->nf_types, node) {
146
0
        if (cJSON_AddStringToObject(nf_typesList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) {
147
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_types]");
148
0
            goto end;
149
0
        }
150
0
    }
151
0
    }
152
153
0
    if (rule_set->nf_domains) {
154
0
    cJSON *nf_domainsList = cJSON_AddArrayToObject(item, "nfDomains");
155
0
    if (nf_domainsList == NULL) {
156
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_domains]");
157
0
        goto end;
158
0
    }
159
0
    OpenAPI_list_for_each(rule_set->nf_domains, node) {
160
0
        if (cJSON_AddStringToObject(nf_domainsList, "", (char*)node->data) == NULL) {
161
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_domains]");
162
0
            goto end;
163
0
        }
164
0
    }
165
0
    }
166
167
0
    if (rule_set->nssais) {
168
0
    cJSON *nssaisList = cJSON_AddArrayToObject(item, "nssais");
169
0
    if (nssaisList == NULL) {
170
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [nssais]");
171
0
        goto end;
172
0
    }
173
0
    OpenAPI_list_for_each(rule_set->nssais, node) {
174
0
        cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(node->data);
175
0
        if (itemLocal == NULL) {
176
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [nssais]");
177
0
            goto end;
178
0
        }
179
0
        cJSON_AddItemToArray(nssaisList, itemLocal);
180
0
    }
181
0
    }
182
183
0
    if (rule_set->nf_instances) {
184
0
    cJSON *nf_instancesList = cJSON_AddArrayToObject(item, "nfInstances");
185
0
    if (nf_instancesList == NULL) {
186
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_instances]");
187
0
        goto end;
188
0
    }
189
0
    OpenAPI_list_for_each(rule_set->nf_instances, node) {
190
0
        if (cJSON_AddStringToObject(nf_instancesList, "", (char*)node->data) == NULL) {
191
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [nf_instances]");
192
0
            goto end;
193
0
        }
194
0
    }
195
0
    }
196
197
0
    if (rule_set->scopes) {
198
0
    cJSON *scopesList = cJSON_AddArrayToObject(item, "scopes");
199
0
    if (scopesList == NULL) {
200
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [scopes]");
201
0
        goto end;
202
0
    }
203
0
    OpenAPI_list_for_each(rule_set->scopes, node) {
204
0
        if (cJSON_AddStringToObject(scopesList, "", (char*)node->data) == NULL) {
205
0
            ogs_error("OpenAPI_rule_set_convertToJSON() failed [scopes]");
206
0
            goto end;
207
0
        }
208
0
    }
209
0
    }
210
211
0
    if (rule_set->action == OpenAPI_rule_set_action_NULL) {
212
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [action]");
213
0
        return NULL;
214
0
    }
215
0
    if (cJSON_AddStringToObject(item, "action", OpenAPI_rule_set_action_ToString(rule_set->action)) == NULL) {
216
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed [action]");
217
0
        goto end;
218
0
    }
219
220
0
end:
221
0
    return item;
222
0
}
223
224
OpenAPI_rule_set_t *OpenAPI_rule_set_parseFromJSON(cJSON *rule_setJSON)
225
10.9k
{
226
10.9k
    OpenAPI_rule_set_t *rule_set_local_var = NULL;
227
10.9k
    OpenAPI_lnode_t *node = NULL;
228
10.9k
    cJSON *priority = NULL;
229
10.9k
    cJSON *plmns = NULL;
230
10.9k
    OpenAPI_list_t *plmnsList = NULL;
231
10.9k
    cJSON *snpns = NULL;
232
10.9k
    OpenAPI_list_t *snpnsList = NULL;
233
10.9k
    cJSON *nf_types = NULL;
234
10.9k
    OpenAPI_list_t *nf_typesList = NULL;
235
10.9k
    cJSON *nf_domains = NULL;
236
10.9k
    OpenAPI_list_t *nf_domainsList = NULL;
237
10.9k
    cJSON *nssais = NULL;
238
10.9k
    OpenAPI_list_t *nssaisList = NULL;
239
10.9k
    cJSON *nf_instances = NULL;
240
10.9k
    OpenAPI_list_t *nf_instancesList = NULL;
241
10.9k
    cJSON *scopes = NULL;
242
10.9k
    OpenAPI_list_t *scopesList = NULL;
243
10.9k
    cJSON *action = NULL;
244
10.9k
    OpenAPI_rule_set_action_e actionVariable = 0;
245
10.9k
    priority = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "priority");
246
10.9k
    if (!priority) {
247
2.58k
        ogs_error("OpenAPI_rule_set_parseFromJSON() failed [priority]");
248
2.58k
        goto end;
249
2.58k
    }
250
8.40k
    if (!cJSON_IsNumber(priority)) {
251
194
        ogs_error("OpenAPI_rule_set_parseFromJSON() failed [priority]");
252
194
        goto end;
253
194
    }
254
255
8.21k
    plmns = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "plmns");
256
8.21k
    if (plmns) {
257
911
        cJSON *plmns_local = NULL;
258
911
        if (!cJSON_IsArray(plmns)) {
259
194
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [plmns]");
260
194
            goto end;
261
194
        }
262
263
717
        plmnsList = OpenAPI_list_create();
264
265
717
        cJSON_ArrayForEach(plmns_local, plmns) {
266
260
            if (!cJSON_IsObject(plmns_local)) {
267
194
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [plmns]");
268
194
                goto end;
269
194
            }
270
66
            OpenAPI_plmn_id_t *plmnsItem = OpenAPI_plmn_id_parseFromJSON(plmns_local);
271
66
            if (!plmnsItem) {
272
66
                ogs_error("No plmnsItem");
273
66
                goto end;
274
66
            }
275
0
            OpenAPI_list_add(plmnsList, plmnsItem);
276
0
        }
277
717
    }
278
279
7.75k
    snpns = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "snpns");
280
7.75k
    if (snpns) {
281
747
        cJSON *snpns_local = NULL;
282
747
        if (!cJSON_IsArray(snpns)) {
283
66
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [snpns]");
284
66
            goto end;
285
66
        }
286
287
681
        snpnsList = OpenAPI_list_create();
288
289
681
        cJSON_ArrayForEach(snpns_local, snpns) {
290
260
            if (!cJSON_IsObject(snpns_local)) {
291
194
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [snpns]");
292
194
                goto end;
293
194
            }
294
66
            OpenAPI_plmn_id_nid_t *snpnsItem = OpenAPI_plmn_id_nid_parseFromJSON(snpns_local);
295
66
            if (!snpnsItem) {
296
66
                ogs_error("No snpnsItem");
297
66
                goto end;
298
66
            }
299
0
            OpenAPI_list_add(snpnsList, snpnsItem);
300
0
        }
301
681
    }
302
303
7.43k
    nf_types = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "nfTypes");
304
7.43k
    if (nf_types) {
305
975
        cJSON *nf_types_local = NULL;
306
975
        if (!cJSON_IsArray(nf_types)) {
307
194
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_types]");
308
194
            goto end;
309
194
        }
310
311
781
        nf_typesList = OpenAPI_list_create();
312
313
3.35k
        cJSON_ArrayForEach(nf_types_local, nf_types) {
314
3.35k
            OpenAPI_nf_type_e localEnum = OpenAPI_nf_type_NULL;
315
3.35k
            if (!cJSON_IsString(nf_types_local)) {
316
280
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_types]");
317
280
                goto end;
318
280
            }
319
3.07k
            localEnum = OpenAPI_nf_type_FromString(nf_types_local->valuestring);
320
3.07k
            if (!localEnum) {
321
1.63k
                ogs_info("Enum value \"%s\" for field \"nf_types\" is not supported. Ignoring it ...",
322
1.63k
                         nf_types_local->valuestring);
323
1.63k
            } else {
324
1.44k
                OpenAPI_list_add(nf_typesList, (void *)localEnum);
325
1.44k
            }
326
3.07k
        }
327
501
        if (nf_typesList->count == 0) {
328
248
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed: Expected nf_typesList to not be empty (after ignoring unsupported enum values).");
329
248
            goto end;
330
248
        }
331
501
    }
332
333
6.71k
    nf_domains = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "nfDomains");
334
6.71k
    if (nf_domains) {
335
930
        cJSON *nf_domains_local = NULL;
336
930
        if (!cJSON_IsArray(nf_domains)) {
337
194
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_domains]");
338
194
            goto end;
339
194
        }
340
341
736
        nf_domainsList = OpenAPI_list_create();
342
343
789
        cJSON_ArrayForEach(nf_domains_local, nf_domains) {
344
789
            double *localDouble = NULL;
345
789
            int *localInt = NULL;
346
789
            if (!cJSON_IsString(nf_domains_local)) {
347
194
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_domains]");
348
194
                goto end;
349
194
            }
350
595
            OpenAPI_list_add(nf_domainsList, ogs_strdup(nf_domains_local->valuestring));
351
595
        }
352
736
    }
353
354
6.32k
    nssais = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "nssais");
355
6.32k
    if (nssais) {
356
1.25k
        cJSON *nssais_local = NULL;
357
1.25k
        if (!cJSON_IsArray(nssais)) {
358
194
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nssais]");
359
194
            goto end;
360
194
        }
361
362
1.06k
        nssaisList = OpenAPI_list_create();
363
364
1.25k
        cJSON_ArrayForEach(nssais_local, nssais) {
365
1.25k
            if (!cJSON_IsObject(nssais_local)) {
366
260
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nssais]");
367
260
                goto end;
368
260
            }
369
993
            OpenAPI_ext_snssai_t *nssaisItem = OpenAPI_ext_snssai_parseFromJSON(nssais_local);
370
993
            if (!nssaisItem) {
371
277
                ogs_error("No nssaisItem");
372
277
                goto end;
373
277
            }
374
716
            OpenAPI_list_add(nssaisList, nssaisItem);
375
716
        }
376
1.06k
    }
377
378
5.59k
    nf_instances = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "nfInstances");
379
5.59k
    if (nf_instances) {
380
1.21k
        cJSON *nf_instances_local = NULL;
381
1.21k
        if (!cJSON_IsArray(nf_instances)) {
382
194
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_instances]");
383
194
            goto end;
384
194
        }
385
386
1.01k
        nf_instancesList = OpenAPI_list_create();
387
388
1.01k
        cJSON_ArrayForEach(nf_instances_local, nf_instances) {
389
941
            double *localDouble = NULL;
390
941
            int *localInt = NULL;
391
941
            if (!cJSON_IsString(nf_instances_local)) {
392
208
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [nf_instances]");
393
208
                goto end;
394
208
            }
395
733
            OpenAPI_list_add(nf_instancesList, ogs_strdup(nf_instances_local->valuestring));
396
733
        }
397
1.01k
    }
398
399
5.19k
    scopes = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "scopes");
400
5.19k
    if (scopes) {
401
966
        cJSON *scopes_local = NULL;
402
966
        if (!cJSON_IsArray(scopes)) {
403
66
            ogs_error("OpenAPI_rule_set_parseFromJSON() failed [scopes]");
404
66
            goto end;
405
66
        }
406
407
900
        scopesList = OpenAPI_list_create();
408
409
962
        cJSON_ArrayForEach(scopes_local, scopes) {
410
962
            double *localDouble = NULL;
411
962
            int *localInt = NULL;
412
962
            if (!cJSON_IsString(scopes_local)) {
413
194
                ogs_error("OpenAPI_rule_set_parseFromJSON() failed [scopes]");
414
194
                goto end;
415
194
            }
416
768
            OpenAPI_list_add(scopesList, ogs_strdup(scopes_local->valuestring));
417
768
        }
418
900
    }
419
420
4.93k
    action = cJSON_GetObjectItemCaseSensitive(rule_setJSON, "action");
421
4.93k
    if (!action) {
422
2.46k
        ogs_error("OpenAPI_rule_set_parseFromJSON() failed [action]");
423
2.46k
        goto end;
424
2.46k
    }
425
2.46k
    if (!cJSON_IsString(action)) {
426
288
        ogs_error("OpenAPI_rule_set_parseFromJSON() failed [action]");
427
288
        goto end;
428
288
    }
429
2.18k
    actionVariable = OpenAPI_rule_set_action_FromString(action->valuestring);
430
431
2.18k
    rule_set_local_var = OpenAPI_rule_set_create (
432
        
433
2.18k
        priority->valuedouble,
434
2.18k
        plmns ? plmnsList : NULL,
435
2.18k
        snpns ? snpnsList : NULL,
436
2.18k
        nf_types ? nf_typesList : NULL,
437
2.18k
        nf_domains ? nf_domainsList : NULL,
438
2.18k
        nssais ? nssaisList : NULL,
439
2.18k
        nf_instances ? nf_instancesList : NULL,
440
2.18k
        scopes ? scopesList : NULL,
441
2.18k
        actionVariable
442
2.18k
    );
443
444
2.18k
    return rule_set_local_var;
445
8.80k
end:
446
8.80k
    if (plmnsList) {
447
506
        OpenAPI_list_for_each(plmnsList, node) {
448
0
            OpenAPI_plmn_id_free(node->data);
449
0
        }
450
506
        OpenAPI_list_free(plmnsList);
451
506
        plmnsList = NULL;
452
506
    }
453
8.80k
    if (snpnsList) {
454
487
        OpenAPI_list_for_each(snpnsList, node) {
455
0
            OpenAPI_plmn_id_nid_free(node->data);
456
0
        }
457
487
        OpenAPI_list_free(snpnsList);
458
487
        snpnsList = NULL;
459
487
    }
460
8.80k
    if (nf_typesList) {
461
561
        OpenAPI_list_free(nf_typesList);
462
561
        nf_typesList = NULL;
463
561
    }
464
8.80k
    if (nf_domainsList) {
465
468
        OpenAPI_list_for_each(nf_domainsList, node) {
466
327
            ogs_free(node->data);
467
327
        }
468
468
        OpenAPI_list_free(nf_domainsList);
469
468
        nf_domainsList = NULL;
470
468
    }
471
8.80k
    if (nssaisList) {
472
795
        OpenAPI_list_for_each(nssaisList, node) {
473
577
            OpenAPI_ext_snssai_free(node->data);
474
577
        }
475
795
        OpenAPI_list_free(nssaisList);
476
795
        nssaisList = NULL;
477
795
    }
478
8.80k
    if (nf_instancesList) {
479
578
        OpenAPI_list_for_each(nf_instancesList, node) {
480
439
            ogs_free(node->data);
481
439
        }
482
578
        OpenAPI_list_free(nf_instancesList);
483
578
        nf_instancesList = NULL;
484
578
    }
485
8.80k
    if (scopesList) {
486
632
        OpenAPI_list_for_each(scopesList, node) {
487
482
            ogs_free(node->data);
488
482
        }
489
632
        OpenAPI_list_free(scopesList);
490
632
        scopesList = NULL;
491
632
    }
492
8.80k
    return NULL;
493
2.46k
}
494
495
OpenAPI_rule_set_t *OpenAPI_rule_set_copy(OpenAPI_rule_set_t *dst, OpenAPI_rule_set_t *src)
496
0
{
497
0
    cJSON *item = NULL;
498
0
    char *content = NULL;
499
500
0
    ogs_assert(src);
501
0
    item = OpenAPI_rule_set_convertToJSON(src);
502
0
    if (!item) {
503
0
        ogs_error("OpenAPI_rule_set_convertToJSON() failed");
504
0
        return NULL;
505
0
    }
506
507
0
    content = cJSON_Print(item);
508
0
    cJSON_Delete(item);
509
510
0
    if (!content) {
511
0
        ogs_error("cJSON_Print() failed");
512
0
        return NULL;
513
0
    }
514
515
0
    item = cJSON_Parse(content);
516
0
    ogs_free(content);
517
0
    if (!item) {
518
0
        ogs_error("cJSON_Parse() failed");
519
0
        return NULL;
520
0
    }
521
522
0
    OpenAPI_rule_set_free(dst);
523
0
    dst = OpenAPI_rule_set_parseFromJSON(item);
524
0
    cJSON_Delete(item);
525
526
0
    return dst;
527
0
}
528