Squashed commit of the following:

Fix the wrong format in nf-instance GET method
This commit is contained in:
Sukchan Lee 2020-05-18 23:07:41 -04:00
parent d0673e3066
commit 1fd3f48860
2 changed files with 35 additions and 14 deletions

View File

@ -3,7 +3,7 @@ title: Fedora
head_inline: "<style> .blue { color: blue; } </style>"
---
This guide is based on **Fedora 30** Distribution.
This guide is based on **Fedora 31** Distribution.
{: .blue}
### Getting MongoDB

View File

@ -6,32 +6,53 @@
cJSON *ogs_sbi_links_convertToJSON(ogs_sbi_links_t *links)
{
cJSON *rootJSON = NULL;
cJSON *root = NULL;
cJSON *object = NULL;
cJSON *linksJSON = NULL;
cJSON *itemsJSON = NULL;
cJSON *selfJSON = NULL;
OpenAPI_lnode_t *node;
ogs_assert(links);
ogs_assert(links->self);
rootJSON = cJSON_CreateObject();
ogs_assert(rootJSON);
linksJSON = cJSON_AddObjectToObject(rootJSON, "_links");
ogs_assert(linksJSON);
itemsJSON = cJSON_AddObjectToObject(linksJSON, "items");
/* _links.items */
itemsJSON = cJSON_CreateArray();
ogs_assert(itemsJSON);
OpenAPI_list_for_each(links->items, node) {
if (!node->data) continue;
cJSON_AddStringToObject(itemsJSON, "href", node->data);
object = cJSON_CreateObject();
ogs_assert(object);
cJSON_AddItemToObject(object, "href", cJSON_CreateString(node->data));
cJSON_AddItemToArray(itemsJSON, object);
}
selfJSON = cJSON_AddObjectToObject(linksJSON, "self");
/* _links.self */
selfJSON = cJSON_CreateObject();
ogs_assert(selfJSON);
cJSON_AddStringToObject(selfJSON, "href", links->self);
return rootJSON;
ogs_assert(links->self);
object = cJSON_CreateString(links->self);
ogs_assert(object);
cJSON_AddItemToObject(selfJSON, "href", object);
/* _links */
linksJSON = cJSON_CreateObject();
ogs_assert(linksJSON);
cJSON_AddItemToObject(linksJSON, "items", itemsJSON);
cJSON_AddItemToObject(linksJSON, "self", selfJSON);
/* root */
root = cJSON_CreateObject();
ogs_assert(root);
cJSON_AddItemToObject(root, "_links", linksJSON);
return root;
}