cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] cxf git commit: Adding general addParameters() method, meant for extension
Date Mon, 05 Sep 2016 15:53:00 GMT
Adding general addParameters() method, meant for extension


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d1627084
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d1627084
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d1627084

Branch: refs/heads/master
Commit: d16270849175faa162ee8c131947657777eb677b
Parents: ea1abee
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Mon Sep 5 17:43:42 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Mon Sep 5 17:44:53 2016 +0200

----------------------------------------------------------------------
 .../swagger/DefaultSwagger2Serializers.java     | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d1627084/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java
----------------------------------------------------------------------
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java
index f5068c7..ec52215 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java
@@ -49,6 +49,7 @@ import io.swagger.models.Operation;
 import io.swagger.models.Path;
 import io.swagger.models.Swagger;
 import io.swagger.models.Tag;
+import io.swagger.models.parameters.Parameter;
 
 public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers
{
 
@@ -61,6 +62,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements
Sw
     protected List<ClassResourceInfo> cris;
 
     protected BeanConfig beanConfig;
+
     @Override
     public void writeTo(
             final Swagger data,
@@ -127,6 +129,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements
Sw
                             subentry.getValue().getParameters().get(i).
                                     setDescription(javadocProvider.getMethodParameterDoc(ori,
i));
                         }
+                        addParameters(subentry.getValue().getParameters());
 
                         if (subentry.getValue().getResponses() != null
                                 && !subentry.getValue().getResponses().isEmpty())
{
@@ -168,6 +171,22 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements
Sw
         return StringUtils.EMPTY.equals(normalizedPath.toString()) ? "/" : normalizedPath.toString();
     }
 
+    /**
+     * Allows to add parameters to the list, related to an {@link Operation} instance; the
method is invoked
+     * for all instances available.
+     *
+     * @param parameters list of parameters defined for an {@link Operation}
+     * @see io.swagger.models.parameters.HeaderParameter
+     * @see io.swagger.models.parameters.CookieParameter
+     * @see io.swagger.models.parameters.PathParameter
+     * @see io.swagger.models.parameters.BodyParameter
+     * @see io.swagger.models.parameters.QueryParameter
+     * @see io.swagger.models.parameters.RefParameter
+     */
+    protected void addParameters(final List<Parameter> parameters) {
+        // does nothing by default
+    }
+
     @Override
     public void setDynamicBasePath(final boolean dynamicBasePath) {
         this.dynamicBasePath = dynamicBasePath;
@@ -181,6 +200,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements
Sw
         this.javadocProvider = javadocProvider;
     }
 
+    @Override
     public void setClassResourceInfos(final List<ClassResourceInfo> classResourceInfos)
{
         this.cris = classResourceInfos;
     }
@@ -200,6 +220,6 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements
Sw
     @Override
     public void setBeanConfig(BeanConfig beanConfig) {
         this.beanConfig = beanConfig;
-        
+
     }
 }


Mime
View raw message