From: PatrikBuhr Date: Mon, 14 Dec 2020 12:45:16 +0000 (+0100) Subject: Removed host from generated api.json X-Git-Tag: 2.2.0~130 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F49%2F5349%2F1;p=portal%2Fnonrtric-controlpanel.git Removed host from generated api.json Change-Id: I02e544d0bb1718fcad1db17faa64766427c8f15f Issue-ID: NONRTRIC-294 Signed-off-by: PatrikBuhr --- diff --git a/docs/api.json b/docs/api.json new file mode 100644 index 0000000..53e1a2f --- /dev/null +++ b/docs/api.json @@ -0,0 +1,451 @@ +{ + "swagger": "2.0", + "info": { + "description": "Proxies access to Near-RT RIC.", + "version": "version not available", + "title": "Non-RT RIC Control Panel backend", + "termsOfService": "Terms of service", + "contact": { + "name": "Non-RT RIC Control Panel Dev Team", + "url": "http://no-docs-yet.org/", + "email": "noreply@O-RAN-SC.org" + }, + "license": { + "name": "Apache 2.0 License", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "basePath": "/", + "tags": [ + { + "name": "enrichment-controller", + "description": "Enrichment Controller" + }, + { + "name": "html-5-paths-controller", + "description": "Html 5 Paths Controller" + }, + { + "name": "policy-controller", + "description": "Policy Controller" + } + ], + "paths": { + "/api/enrichment/eijobs": { + "get": { + "tags": [ + "enrichment-controller" + ], + "summary": "Get the EI job definitions for one EI producer", + "operationId": "getEiJobsUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ei_job_request" + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, + "/api/enrichment/eiproducers": { + "get": { + "tags": [ + "enrichment-controller" + ], + "summary": "Get EI producers", + "operationId": "getEiProducersUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ei_producer" + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, + "/api/policy/policies": { + "get": { + "tags": [ + "policy-controller" + ], + "summary": "Returns the policy instances for the given policy type.", + "operationId": "getPolicyInstancesUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "type", + "in": "query", + "description": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, + "/api/policy/policies/{policy_instance_id}": { + "get": { + "tags": [ + "policy-controller" + ], + "summary": "Returns a policy instance of a type", + "operationId": "getPolicyInstanceUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "policy_instance_id", + "in": "path", + "description": "policy_instance_id", + "required": true, + "type": "string" + }, + { + "name": "type", + "in": "query", + "description": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + }, + "put": { + "tags": [ + "policy-controller" + ], + "summary": "Creates the policy instances for the given policy type.", + "operationId": "putPolicyInstanceUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "instance", + "description": "instance", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "policy_instance_id", + "in": "path", + "description": "policy_instance_id", + "required": true, + "type": "string" + }, + { + "name": "ric", + "in": "query", + "description": "ric", + "required": true, + "type": "string" + }, + { + "name": "type", + "in": "query", + "description": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + }, + "delete": { + "tags": [ + "policy-controller" + ], + "summary": "Deletes the policy instances for the given policy type.", + "operationId": "deletePolicyInstanceUsingDELETE", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "policy_instance_id", + "in": "path", + "description": "policy_instance_id", + "required": true, + "type": "string" + }, + { + "name": "type", + "in": "query", + "description": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false + } + }, + "/api/policy/policytypes": { + "get": { + "tags": [ + "policy-controller" + ], + "summary": "Gets the policy types from Near-RT RIC", + "operationId": "getAllPolicyTypesUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, + "/api/policy/rics": { + "get": { + "tags": [ + "policy-controller" + ], + "summary": "Returns the rics supporting the given policy type.", + "operationId": "getRicsSupportingTypeUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "policyType", + "in": "query", + "description": "policyType", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, + "/policy": { + "get": { + "tags": [ + "html-5-paths-controller" + ], + "summary": "forwardAngularRoutes", + "operationId": "forwardAngularRoutesUsingGET", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + } + }, + "definitions": { + "ei_job_request": { + "type": "object", + "required": [ + "ei_job_identity" + ], + "properties": { + "ei_job_data": { + "type": "object", + "description": "Json for the job data" + }, + "ei_job_identity": { + "type": "string", + "description": "Identity of the EI job" + }, + "ei_type_identity": { + "type": "string", + "description": "Type identity for the job" + }, + "owner": { + "type": "string", + "description": "The owner of the job" + }, + "target_uri": { + "type": "string", + "description": "URI for the target of the EI" + } + }, + "title": "ei_job_request", + "description": "The EI job" + }, + "ei_producer": { + "type": "object", + "required": [ + "ei_producer_id", + "ei_producer_types", + "status" + ], + "properties": { + "ei_producer_id": { + "type": "string", + "description": "Idenitity of the EI producer" + }, + "ei_producer_types": { + "type": "array", + "description": "Types provided by the EI producer", + "items": { + "type": "string" + } + }, + "status": { + "type": "string", + "description": "Status of the EI producer" + } + }, + "title": "ei_producer", + "description": "The EI producer" + } + } +} diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java index c4acad2..5a0cd71 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/RestApiTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; -import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.io.BufferedReader; @@ -72,7 +72,8 @@ class RestApiTest { String url = "/v2/api-docs"; ResponseEntity resp = restClient().getForEntity(url).block(); assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK); - JsonElement jsonElement = JsonParser.parseString(resp.getBody()); + JsonObject jsonElement = JsonParser.parseString(resp.getBody()).getAsJsonObject(); + jsonElement.remove("host"); String indented = gson.toJson(jsonElement); try (PrintStream out = new PrintStream(new FileOutputStream("../docs/api.json"))) { out.println(indented);