OpenAPI: Change openapi URLs 49/106149/3
authorYaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Wed, 24 May 2023 14:19:50 +0000 (17:19 +0300)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Mon, 29 May 2023 07:46:07 +0000 (09:46 +0200)
The URL structure for accessing the OpenAPI documentation and
API endpoints did not align with the name of module and feature.

URL contextPath "apidoc" was changed to "openapi".

JIRA: NETCONF-1032
Change-Id: Ifa09544f53963065a974466e8a7f4eb3262326f0
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/jaxrs/WebInitializer.java
restconf/restconf-openapi/src/main/resources/explorer/swagger-initializer.js

index 6922f15fe49379282ad3447d7db8bd391c076fab..6ff25a389d2859ef1882bef068bc50d46617cbad 100644 (file)
@@ -41,11 +41,11 @@ public final class WebInitializer implements AutoCloseable {
                 throws ServletException {
         final var webContextBuilder = WebContext.builder()
             .name("OpenAPI")
-            .contextPath("/apidoc")
+            .contextPath("/openapi")
             .supportsSessions(true)
             .addServlet(ServletDetails.builder()
                 .servlet(servletSupport.createHttpServletBuilder(new OpenApiApplication(openApiService)).build())
-                .addUrlPattern("/openapi3/apis/*")
+                .addUrlPattern("/api/v3/*")
                 .build())
             .addResource(ResourceDetails.builder().name("/explorer").build());
 
index 21e0b5d4263bde08759f929c792f440166694750..d57e5878a29f0ad2f2d0cf69b1f66d05d3a6279d 100644 (file)
@@ -1,10 +1,10 @@
 window.onload = function() {
     var xmlHttp = new XMLHttpRequest();
-    xmlHttp.open("GET", document.URL.split('/apidoc')[0] + "/apidoc/openapi3/apis/mounts", false);
+    xmlHttp.open("GET", document.URL.split('/openapi')[0] + "/openapi/api/v3/mounts", false);
     xmlHttp.send( null );
 
-    var base_url_rfc = document.URL.split('/apidoc')[0] + '/apidoc/openapi3/apis/mounts/';
-    var swagger_urls = [{url: document.URL.split('/apidoc')[0] + "/apidoc/openapi3/apis/single", name: "Controller resources - RestConf RFC 8040"}];
+    var base_url_rfc = document.URL.split('/openapi')[0] + '/openapi/api/v3/mounts/';
+    var swagger_urls = [{url: document.URL.split('/openapi')[0] + "/openapi/api/v3/single", name: "Controller resources - RestConf RFC 8040"}];
     var devices = JSON.parse(xmlHttp.responseText);
     for (var i =0; i < devices.length; i++) {
       var device_name = devices[i]['instance'].split('=')[2].replace('/', '');