Fix YangLib media types 00/104800/5
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Wed, 8 Mar 2023 09:22:03 +0000 (10:22 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 9 Mar 2023 09:12:41 +0000 (09:12 +0000)
Fix YangLib media types to return "application/yang" with default
fallback to "text/plain".

JIRA: NETCONF-972
Change-Id: Ibd7a6939342cfbe4b525442d8606e4c27d3e8b65
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
netconf/yanglib/src/main/java/org/opendaylight/yanglib/api/YangLibService.java

index 5ae0853584ece7b5d3dd174f367b1fdf93ca1132..8701eba24f722ec866c8babb443604fdcb28bd58 100644 (file)
@@ -5,18 +5,20 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yanglib.api;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.opendaylight.yangtools.yang.common.YangConstants;
 
 /**
  * Service provides YANG schema sources for modules from yang library.
  */
 @Path("/")
+@Produces({ MediaType.TEXT_PLAIN, YangConstants.RFC6020_YANG_MEDIA_TYPE })
 public interface YangLibService {
 
     /**
@@ -26,7 +28,6 @@ public interface YangLibService {
      * @return Module's source
      */
     @GET
-    @Produces("text/plain")
     @Path("/schemas/{modelName}/{revision:([0-9\\-]*)}")
     String getSchema(@PathParam("modelName") String name, @PathParam("revision") String revision);
 }