[5/6] cxf git commit: Do not initialize if no swagger-jaxrs classes are found
Do not initialize if no swagger-jaxrs classes are found Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/df453769 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/df453769 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/df453769 Branch: refs/heads/3.0.x-fixes Commit: df453769ffbf72b7277c9b240d39894198a3d954 Parents: bcbf653 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:37:20 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:48:09 2015 +0100 -- .../jaxrs/swagger/AbstractSwaggerFeature.java | 28 1 file changed, 23 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/df453769/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java index 87dfdfe..08d2e16 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java @@ -25,6 +25,13 @@ import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean; import org.apache.cxf.jaxrs.model.AbstractResourceInfo; public abstract class AbstractSwaggerFeature extends AbstractFeature { + +private static final boolean SWAGGER_JAXRS_AVAILABLE; + +static { +SWAGGER_JAXRS_AVAILABLE = isSwaggerJaxRsAvailable(); +} + protected boolean scan = true; protected boolean runAsFilter; private String resourcePackage; @@ -39,13 +46,24 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { private String termsOfServiceUrl; private String filterClass; +private static boolean isSwaggerJaxRsAvailable() { +try { +Class.forName("io.swagger.jaxrs.DefaultParameterExtension"); +return true; +} catch (Throwable ex) { +return false; +} +} + @Override public void initialize(Server server, Bus bus) { -calculateDefaultResourcePackage(server); -calculateDefaultBasePath(server); -addSwaggerResource(server); - -initializeProvider(server.getEndpoint(), bus); +if (SWAGGER_JAXRS_AVAILABLE) { +calculateDefaultResourcePackage(server); +calculateDefaultBasePath(server); +addSwaggerResource(server); + +initializeProvider(server.getEndpoint(), bus); +} } protected abstract void addSwaggerResource(Server server);
[1/3] cxf git commit: Introducing activateOnlyIfJaxrsSupported for explicit activation control
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes ec399a6a7 -> 3378549cb refs/heads/3.1.x-fixes e4c456743 -> 4870b845d refs/heads/master e915cfd79 -> 3d15737a9 Introducing activateOnlyIfJaxrsSupported for explicit activation control Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4870b845 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4870b845 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4870b845 Branch: refs/heads/3.1.x-fixes Commit: 4870b845d0b04db2e0d03d7f4aa2cefc2edb1bf4 Parents: e4c4567 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 17:09:06 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 17:09:06 2015 +0100 -- .../cxf/jaxrs/swagger/AbstractSwaggerFeature.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/4870b845/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java index 08d2e16..386855d 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java @@ -34,6 +34,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { protected boolean scan = true; protected boolean runAsFilter; +private boolean activateOnlyIfJaxrsSupported; private String resourcePackage; private String version = "1.0.0"; // depending on swagger version basePath is set differently @@ -57,7 +58,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { @Override public void initialize(Server server, Bus bus) { -if (SWAGGER_JAXRS_AVAILABLE) { +if (!activateOnlyIfJaxrsSupported || SWAGGER_JAXRS_AVAILABLE) { calculateDefaultResourcePackage(server); calculateDefaultBasePath(server); addSwaggerResource(server); @@ -161,4 +162,13 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { public void setRunAsFilter(boolean runAsFilter) { this.runAsFilter = runAsFilter; } + +public boolean isActivateOnlyIfJaxrsSupported() { +return activateOnlyIfJaxrsSupported; +} + +public void setActivateOnlyIfJaxrsSupported(boolean activateOnlyIfJaxrsSupported) { +this.activateOnlyIfJaxrsSupported = activateOnlyIfJaxrsSupported; +} + }
[3/6] cxf git commit: Do not initialize if no swagger-jaxrs classes are found
Do not initialize if no swagger-jaxrs classes are found Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/dcaaabff Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/dcaaabff Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/dcaaabff Branch: refs/heads/master Commit: dcaaabff35c696eeb188acaf19af20c0b88e97a6 Parents: afe7a56 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:37:20 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:42:58 2015 +0100 -- .../jaxrs/swagger/AbstractSwaggerFeature.java | 28 1 file changed, 23 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/dcaaabff/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java index 87dfdfe..08d2e16 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java @@ -25,6 +25,13 @@ import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean; import org.apache.cxf.jaxrs.model.AbstractResourceInfo; public abstract class AbstractSwaggerFeature extends AbstractFeature { + +private static final boolean SWAGGER_JAXRS_AVAILABLE; + +static { +SWAGGER_JAXRS_AVAILABLE = isSwaggerJaxRsAvailable(); +} + protected boolean scan = true; protected boolean runAsFilter; private String resourcePackage; @@ -39,13 +46,24 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { private String termsOfServiceUrl; private String filterClass; +private static boolean isSwaggerJaxRsAvailable() { +try { +Class.forName("io.swagger.jaxrs.DefaultParameterExtension"); +return true; +} catch (Throwable ex) { +return false; +} +} + @Override public void initialize(Server server, Bus bus) { -calculateDefaultResourcePackage(server); -calculateDefaultBasePath(server); -addSwaggerResource(server); - -initializeProvider(server.getEndpoint(), bus); +if (SWAGGER_JAXRS_AVAILABLE) { +calculateDefaultResourcePackage(server); +calculateDefaultBasePath(server); +addSwaggerResource(server); + +initializeProvider(server.getEndpoint(), bus); +} } protected abstract void addSwaggerResource(Server server);
[4/6] cxf git commit: Support multiple URLs for javadocs
Support multiple URLs for javadocs Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e915cfd7 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e915cfd7 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e915cfd7 Branch: refs/heads/master Commit: e915cfd794504a9b1522275b3052d0a3b3ff3876 Parents: dcaaabf Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:38:13 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:42:58 2015 +0100 -- .../cxf/jaxrs/model/doc/JavaDocProvider.java| 49 --- .../cxf/jaxrs/model/wadl/WadlGenerator.java | 138 ++- .../cxf/jaxrs/swagger/Swagger2Feature.java | 12 +- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 12 +- 4 files changed, 119 insertions(+), 92 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/e915cfd7/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java index ae81234..5e702fe 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java @@ -44,22 +44,35 @@ public class JavaDocProvider implements DocumentationProvider { public static final double JAVA_VERSION_18 = 1.8D; private ClassLoader javaDocLoader; -private ConcurrentHashMap docs = new ConcurrentHashMap (); +private final ConcurrentHashMap docs = new ConcurrentHashMap<>(); private double javaDocsBuiltByVersion = JAVA_VERSION; -public JavaDocProvider(URL javaDocUrl) { -if (javaDocUrl == null) { -throw new IllegalArgumentException("URL is null"); +public JavaDocProvider(URL... javaDocUrls) { +if (javaDocUrls == null) { +throw new IllegalArgumentException("URL are null"); } -javaDocLoader = new URLClassLoader(new URL[]{javaDocUrl}); + +javaDocLoader = new URLClassLoader(javaDocUrls); } public JavaDocProvider(String path) throws Exception { this(BusFactory.getDefaultBus(), path); } -public JavaDocProvider(Bus bus, String path) throws Exception { -this(ResourceUtils.getResourceURL(path, bus)); +public JavaDocProvider(String... paths) throws Exception { +this(BusFactory.getDefaultBus(), paths == null ? null : paths); +} + +public JavaDocProvider(Bus bus, String... paths) throws Exception { +if (paths == null) { +throw new IllegalArgumentException("paths are null"); +} + +URL[] javaDocUrls = new URL[paths.length]; +for (int i = 0; i < paths.length; i++) { +javaDocUrls[i] = ResourceUtils.getResourceURL(paths[i], bus); +} +javaDocLoader = new URLClassLoader(javaDocUrls); } private static double getVersion() { @@ -71,6 +84,7 @@ public class JavaDocProvider implements DocumentationProvider { } } +@Override public String getClassDoc(ClassResourceInfo cri) { try { ClassDocs doc = getClassDocInternal(cri.getServiceClass()); @@ -84,6 +98,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -97,6 +112,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodResponseDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -110,6 +126,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodParameterDoc(OperationResourceInfo ori, int paramIndex) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -211,7 +228,7 @@ public class JavaDocProvider implements DocumentationProvider { String operInfoTag = getOperInfoTag(); String operInfo = getJavaDocText(operDoc, operInfoTag, operLink, 0); String responseInfo = null; -List paramDocs = new LinkedList(); +List paramDocs = new LinkedList<>(); if (!StringUtils.isEmpty(operInfo)) { int returnsIndex = operDoc.indexOf("Returns:",
[2/6] cxf git commit: Support multiple URLs for javadocs
Support multiple URLs for javadocs Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e4c45674 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e4c45674 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e4c45674 Branch: refs/heads/3.1.x-fixes Commit: e4c456743a046f37ce9623529635218be7f13e7b Parents: 8c02d3c Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:38:13 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:38:13 2015 +0100 -- .../cxf/jaxrs/model/doc/JavaDocProvider.java| 49 --- .../cxf/jaxrs/model/wadl/WadlGenerator.java | 138 ++- .../cxf/jaxrs/swagger/Swagger2Feature.java | 12 +- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 12 +- 4 files changed, 119 insertions(+), 92 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/e4c45674/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java index ae81234..5e702fe 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java @@ -44,22 +44,35 @@ public class JavaDocProvider implements DocumentationProvider { public static final double JAVA_VERSION_18 = 1.8D; private ClassLoader javaDocLoader; -private ConcurrentHashMap docs = new ConcurrentHashMap (); +private final ConcurrentHashMap docs = new ConcurrentHashMap<>(); private double javaDocsBuiltByVersion = JAVA_VERSION; -public JavaDocProvider(URL javaDocUrl) { -if (javaDocUrl == null) { -throw new IllegalArgumentException("URL is null"); +public JavaDocProvider(URL... javaDocUrls) { +if (javaDocUrls == null) { +throw new IllegalArgumentException("URL are null"); } -javaDocLoader = new URLClassLoader(new URL[]{javaDocUrl}); + +javaDocLoader = new URLClassLoader(javaDocUrls); } public JavaDocProvider(String path) throws Exception { this(BusFactory.getDefaultBus(), path); } -public JavaDocProvider(Bus bus, String path) throws Exception { -this(ResourceUtils.getResourceURL(path, bus)); +public JavaDocProvider(String... paths) throws Exception { +this(BusFactory.getDefaultBus(), paths == null ? null : paths); +} + +public JavaDocProvider(Bus bus, String... paths) throws Exception { +if (paths == null) { +throw new IllegalArgumentException("paths are null"); +} + +URL[] javaDocUrls = new URL[paths.length]; +for (int i = 0; i < paths.length; i++) { +javaDocUrls[i] = ResourceUtils.getResourceURL(paths[i], bus); +} +javaDocLoader = new URLClassLoader(javaDocUrls); } private static double getVersion() { @@ -71,6 +84,7 @@ public class JavaDocProvider implements DocumentationProvider { } } +@Override public String getClassDoc(ClassResourceInfo cri) { try { ClassDocs doc = getClassDocInternal(cri.getServiceClass()); @@ -84,6 +98,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -97,6 +112,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodResponseDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -110,6 +126,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodParameterDoc(OperationResourceInfo ori, int paramIndex) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -211,7 +228,7 @@ public class JavaDocProvider implements DocumentationProvider { String operInfoTag = getOperInfoTag(); String operInfo = getJavaDocText(operDoc, operInfoTag, operLink, 0); String responseInfo = null; -List paramDocs = new LinkedList(); +List paramDocs = new LinkedList<>(); if (!StringUtils.isEmpty(operInfo)) { int returnsIndex =
[1/6] cxf git commit: Do not initialize if no swagger-jaxrs classes are found
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes bcbf6534f -> ec399a6a7 refs/heads/3.1.x-fixes 4685f0687 -> e4c456743 refs/heads/master afe7a56f1 -> e915cfd79 Do not initialize if no swagger-jaxrs classes are found Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8c02d3c8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8c02d3c8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8c02d3c8 Branch: refs/heads/3.1.x-fixes Commit: 8c02d3c817c730851ebe748043daaec10190b125 Parents: 4685f06 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:37:20 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:37:20 2015 +0100 -- .../jaxrs/swagger/AbstractSwaggerFeature.java | 28 1 file changed, 23 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/8c02d3c8/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java index 87dfdfe..08d2e16 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java @@ -25,6 +25,13 @@ import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean; import org.apache.cxf.jaxrs.model.AbstractResourceInfo; public abstract class AbstractSwaggerFeature extends AbstractFeature { + +private static final boolean SWAGGER_JAXRS_AVAILABLE; + +static { +SWAGGER_JAXRS_AVAILABLE = isSwaggerJaxRsAvailable(); +} + protected boolean scan = true; protected boolean runAsFilter; private String resourcePackage; @@ -39,13 +46,24 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { private String termsOfServiceUrl; private String filterClass; +private static boolean isSwaggerJaxRsAvailable() { +try { +Class.forName("io.swagger.jaxrs.DefaultParameterExtension"); +return true; +} catch (Throwable ex) { +return false; +} +} + @Override public void initialize(Server server, Bus bus) { -calculateDefaultResourcePackage(server); -calculateDefaultBasePath(server); -addSwaggerResource(server); - -initializeProvider(server.getEndpoint(), bus); +if (SWAGGER_JAXRS_AVAILABLE) { +calculateDefaultResourcePackage(server); +calculateDefaultBasePath(server); +addSwaggerResource(server); + +initializeProvider(server.getEndpoint(), bus); +} } protected abstract void addSwaggerResource(Server server);
[6/6] cxf git commit: Support multiple URLs for javadocs
Support multiple URLs for javadocs Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ec399a6a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ec399a6a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ec399a6a Branch: refs/heads/3.0.x-fixes Commit: ec399a6a7e838614ffdd8d2531dd21fdf29ff51c Parents: df45376 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 15:58:57 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 15:58:57 2015 +0100 -- .../cxf/jaxrs/model/doc/JavaDocProvider.java| 47 +++ .../cxf/jaxrs/model/wadl/WadlGenerator.java | 85 +++- .../cxf/jaxrs/swagger/Swagger2Feature.java | 12 ++- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 12 +-- 4 files changed, 94 insertions(+), 62 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ec399a6a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java index b3fe34a..942eb04 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java @@ -44,22 +44,35 @@ public class JavaDocProvider implements DocumentationProvider { public static final double JAVA_VERSION_18 = 1.8D; private ClassLoader javaDocLoader; -private ConcurrentHashMap docs = new ConcurrentHashMap (); +private final ConcurrentHashMap docs = new ConcurrentHashMap (); private double javaDocsBuiltByVersion = JAVA_VERSION; -public JavaDocProvider(URL javaDocUrl) { -if (javaDocUrl == null) { -throw new IllegalArgumentException("URL is null"); +public JavaDocProvider(URL... javaDocUrls) { +if (javaDocUrls == null) { +throw new IllegalArgumentException("URL are null"); } -javaDocLoader = new URLClassLoader(new URL[]{javaDocUrl}); + +javaDocLoader = new URLClassLoader(javaDocUrls); } public JavaDocProvider(String path) throws Exception { this(BusFactory.getDefaultBus(), path); } -public JavaDocProvider(Bus bus, String path) throws Exception { -this(ResourceUtils.getResourceURL(path, bus)); +public JavaDocProvider(String... paths) throws Exception { +this(BusFactory.getDefaultBus(), paths == null ? null : paths); +} + +public JavaDocProvider(Bus bus, String... paths) throws Exception { +if (paths == null) { +throw new IllegalArgumentException("paths are null"); +} + +URL[] javaDocUrls = new URL[paths.length]; +for (int i = 0; i < paths.length; i++) { +javaDocUrls[i] = ResourceUtils.getResourceURL(paths[i], bus); +} +javaDocLoader = new URLClassLoader(javaDocUrls); } private static double getVersion() { @@ -71,6 +84,7 @@ public class JavaDocProvider implements DocumentationProvider { } } +@Override public String getClassDoc(ClassResourceInfo cri) { try { ClassDocs doc = getClassDocInternal(cri.getServiceClass()); @@ -84,6 +98,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -97,6 +112,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodResponseDoc(OperationResourceInfo ori) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -110,6 +126,7 @@ public class JavaDocProvider implements DocumentationProvider { return null; } +@Override public String getMethodParameterDoc(OperationResourceInfo ori, int paramIndex) { try { MethodDocs doc = getOperationDocInternal(ori); @@ -228,7 +245,7 @@ public class JavaDocProvider implements DocumentationProvider { int codeIndex = paramString.indexOf(codeTag); while (codeIndex != -1) { -int next = paramString.indexOf("<", codeIndex + 7); +int next = paramString.indexOf('<', codeIndex + 7); if (next == -1) { next
[2/3] cxf git commit: Introducing activateOnlyIfJaxrsSupported for explicit activation control
Introducing activateOnlyIfJaxrsSupported for explicit activation control Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3378549c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3378549c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3378549c Branch: refs/heads/3.0.x-fixes Commit: 3378549cbf27481db9d0424c6f7fe47d357103cb Parents: ec399a6 Author: Francesco ChicchiriccòAuthored: Wed Dec 2 17:09:06 2015 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 2 17:09:21 2015 +0100 -- .../cxf/jaxrs/swagger/AbstractSwaggerFeature.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/3378549c/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java index 08d2e16..386855d 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java @@ -34,6 +34,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { protected boolean scan = true; protected boolean runAsFilter; +private boolean activateOnlyIfJaxrsSupported; private String resourcePackage; private String version = "1.0.0"; // depending on swagger version basePath is set differently @@ -57,7 +58,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { @Override public void initialize(Server server, Bus bus) { -if (SWAGGER_JAXRS_AVAILABLE) { +if (!activateOnlyIfJaxrsSupported || SWAGGER_JAXRS_AVAILABLE) { calculateDefaultResourcePackage(server); calculateDefaultBasePath(server); addSwaggerResource(server); @@ -161,4 +162,13 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature { public void setRunAsFilter(boolean runAsFilter) { this.runAsFilter = runAsFilter; } + +public boolean isActivateOnlyIfJaxrsSupported() { +return activateOnlyIfJaxrsSupported; +} + +public void setActivateOnlyIfJaxrsSupported(boolean activateOnlyIfJaxrsSupported) { +this.activateOnlyIfJaxrsSupported = activateOnlyIfJaxrsSupported; +} + }
[2/3] cxf git commit: Improving bean validation annotations support for @MatrixPatam and @BeanParam fields
Improving bean validation annotations support for @MatrixPatam and @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8a765e0b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8a765e0b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8a765e0b Branch: refs/heads/master Commit: 8a765e0b49200ccc5bab5a5290e826b15528899f Parents: 4eede5f Author: Francesco ChicchiriccòAuthored: Fri Dec 4 10:16:11 2015 +0100 Committer: Francesco Chicchiriccò Committed: Fri Dec 4 10:16:35 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 85 +--- 1 file changed, 37 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/8a765e0b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index b89a5e9..87e0cf2 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -46,8 +46,8 @@ import io.swagger.converter.ModelConverters; import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.AbstractSerializableParameter; import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -80,6 +80,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (schema != null) { mp.setProperty(schema); } +applyBeanValidatorAnnotations(mp, annotations); parameters.add(mp); } else if (annotation instanceof BeanParam) { // Use Jackson's logic for processing Beans @@ -163,72 +164,60 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { /** * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. * - * @param property + * @param parameter * @param annotations */ -private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +private void applyBeanValidatorAnnotations(final Parameter parameter, final List annotations) { Map annos = new HashMap<>(); if (annotations != null) { for (Annotation annotation : annotations) { annos.put(annotation.annotationType().getName(), annotation); } } + if (annos.containsKey(NotNull.class.getName())) { -property.setRequired(true); -} -if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { -Min min = (Min) annos.get(Min.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(min.value())); -} -if (annos.containsKey(Max.class.getName()) && property instanceof AbstractNumericProperty) { -Max max = (Max) annos.get(Max.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMaximum(new Double(max.value())); +parameter.setRequired(true); } -if (annos.containsKey(Size.class.getName())) { -Size size = (Size) annos.get(Size.class.getName()); -if (property instanceof AbstractNumericProperty) { -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(size.min())); -ap.setMaximum(new Double(size.max())); -} else if (property instanceof StringProperty) { -StringProperty sp = (StringProperty) property; -sp.minLength(size.min()); -sp.maxLength(size.max()); -} else if (property instanceof ArrayProperty) { -ArrayProperty sp = (ArrayProperty) property; -sp.setMinItems(size.min()); -sp.setMaxItems(size.max()); + +if (parameter instanceof AbstractSerializableParameter) { +AbstractSerializableParameter serializable = (AbstractSerializableParameter) parameter; + +if
[1/3] cxf git commit: [CXF-6695] Improving bean validation annotations support for @MatrixPatam and @BeanParam fields
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 98f176f5b -> d2a2a2494 refs/heads/3.1.x-fixes 3df27048c -> 8a9952073 refs/heads/master 4eede5fc4 -> 8a765e0b4 [CXF-6695] Improving bean validation annotations support for @MatrixPatam and @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8a995207 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8a995207 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8a995207 Branch: refs/heads/3.1.x-fixes Commit: 8a9952073cf5edffd848c43d63ac173a2c7455a5 Parents: 3df2704 Author: Francesco ChicchiriccòAuthored: Fri Dec 4 10:16:11 2015 +0100 Committer: Francesco Chicchiriccò Committed: Fri Dec 4 10:16:11 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 85 +--- 1 file changed, 37 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/8a995207/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index b89a5e9..87e0cf2 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -46,8 +46,8 @@ import io.swagger.converter.ModelConverters; import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.AbstractSerializableParameter; import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -80,6 +80,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (schema != null) { mp.setProperty(schema); } +applyBeanValidatorAnnotations(mp, annotations); parameters.add(mp); } else if (annotation instanceof BeanParam) { // Use Jackson's logic for processing Beans @@ -163,72 +164,60 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { /** * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. * - * @param property + * @param parameter * @param annotations */ -private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +private void applyBeanValidatorAnnotations(final Parameter parameter, final List annotations) { Map annos = new HashMap<>(); if (annotations != null) { for (Annotation annotation : annotations) { annos.put(annotation.annotationType().getName(), annotation); } } + if (annos.containsKey(NotNull.class.getName())) { -property.setRequired(true); -} -if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { -Min min = (Min) annos.get(Min.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(min.value())); -} -if (annos.containsKey(Max.class.getName()) && property instanceof AbstractNumericProperty) { -Max max = (Max) annos.get(Max.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMaximum(new Double(max.value())); +parameter.setRequired(true); } -if (annos.containsKey(Size.class.getName())) { -Size size = (Size) annos.get(Size.class.getName()); -if (property instanceof AbstractNumericProperty) { -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(size.min())); -ap.setMaximum(new Double(size.max())); -} else if (property instanceof StringProperty) { -StringProperty sp = (StringProperty) property; -sp.minLength(size.min()); -sp.maxLength(size.max()); -} else if (property instanceof ArrayProperty) { -ArrayProperty sp = (ArrayProperty) property; -sp.setMinItems(size.min()); -sp.setMaxItems(size.max()); + +if (parameter
[3/3] cxf git commit: [CXF-6695] Improving bean validation annotations support for @MatrixPatam and @BeanParam fields
[CXF-6695] Improving bean validation annotations support for @MatrixPatam and @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d2a2a249 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d2a2a249 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d2a2a249 Branch: refs/heads/3.0.x-fixes Commit: d2a2a2494799becde52f50e3edfb80bfc79b4dda Parents: 98f176f Author: Francesco ChicchiriccòAuthored: Fri Dec 4 10:27:24 2015 +0100 Committer: Francesco Chicchiriccò Committed: Fri Dec 4 10:27:24 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 85 +--- 1 file changed, 37 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/d2a2a249/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index bba367f..fc76cfc 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -46,8 +46,8 @@ import io.swagger.converter.ModelConverters; import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.AbstractSerializableParameter; import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -80,6 +80,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (schema != null) { mp.setProperty(schema); } +applyBeanValidatorAnnotations(mp, annotations); parameters.add(mp); } else if (annotation instanceof BeanParam) { // Use Jackson's logic for processing Beans @@ -163,72 +164,60 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { /** * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. * - * @param property + * @param parameter * @param annotations */ -private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +private void applyBeanValidatorAnnotations(final Parameter parameter, final List annotations) { Map annos = new HashMap (); if (annotations != null) { for (Annotation annotation : annotations) { annos.put(annotation.annotationType().getName(), annotation); } } + if (annos.containsKey(NotNull.class.getName())) { -property.setRequired(true); -} -if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { -Min min = (Min) annos.get(Min.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(min.value())); -} -if (annos.containsKey(Max.class.getName()) && property instanceof AbstractNumericProperty) { -Max max = (Max) annos.get(Max.class.getName()); -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMaximum(new Double(max.value())); +parameter.setRequired(true); } -if (annos.containsKey(Size.class.getName())) { -Size size = (Size) annos.get(Size.class.getName()); -if (property instanceof AbstractNumericProperty) { -AbstractNumericProperty ap = (AbstractNumericProperty) property; -ap.setMinimum(new Double(size.min())); -ap.setMaximum(new Double(size.max())); -} else if (property instanceof StringProperty) { -StringProperty sp = (StringProperty) property; -sp.minLength(size.min()); -sp.maxLength(size.max()); -} else if (property instanceof ArrayProperty) { -ArrayProperty sp = (ArrayProperty) property; -sp.setMinItems(size.min()); -sp.setMaxItems(size.max()); + +if (parameter instanceof AbstractSerializableParameter) { +AbstractSerializableParameter serializable = (AbstractSerializableParameter) parameter; + +
[2/3] cxf git commit: Handling bean validation annotations for @BeanParam fields
Handling bean validation annotations for @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/70298efb Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/70298efb Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/70298efb Branch: refs/heads/master Commit: 70298efb50b53480b4030f8ff852d0e822dc0616 Parents: 1f608e3 Author: Francesco ChicchiriccòAuthored: Thu Dec 3 14:30:45 2015 +0100 Committer: Francesco Chicchiriccò Committed: Thu Dec 3 14:31:41 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 89 +++- 1 file changed, 87 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/70298efb/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index 3c8ae95..b89a5e9 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -21,9 +21,18 @@ package org.apache.cxf.jaxrs.swagger; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import javax.ws.rs.BeanParam; import javax.ws.rs.MatrixParam; @@ -38,6 +47,7 @@ import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -115,6 +125,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { // since downstream processors won't know how to introspect @BeanParam, process here for (Parameter param : extracted) { if (ParameterProcessor.applyAnnotations(null, param, paramType, paramAnnotations) != null) { +applyBeanValidatorAnnotations(param, paramAnnotations); parameters.add(param); } } @@ -130,11 +141,11 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { return parameters; } -private Property createProperty(Type type) { +private Property createProperty(final Type type) { return enforcePrimitive(ModelConverters.getInstance().readAsProperty(type), 0); } -private Property enforcePrimitive(Property in, int level) { +private Property enforcePrimitive(final Property in, final int level) { if (in instanceof RefProperty) { return new StringProperty(); } @@ -148,4 +159,78 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { } return in; } + +/** + * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. + * + * @param property + * @param annotations + */ +private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +Map annos = new HashMap<>(); +if (annotations != null) { +for (Annotation annotation : annotations) { +annos.put(annotation.annotationType().getName(), annotation); +} +} +if (annos.containsKey(NotNull.class.getName())) { +property.setRequired(true); +} +if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { +Min min = (Min) annos.get(Min.class.getName()); +AbstractNumericProperty ap = (AbstractNumericProperty) property; +ap.setMinimum(new Double(min.value())); +} +if (annos.containsKey(Max.class.getName()) && property instanceof AbstractNumericProperty) { +Max max = (Max) annos.get(Max.class.getName()); +AbstractNumericProperty ap =
[3/3] cxf git commit: [CXF-6695] Handling bean validation annotations for @BeanParam fields
[CXF-6695] Handling bean validation annotations for @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b1ab9e91 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b1ab9e91 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b1ab9e91 Branch: refs/heads/3.0.x-fixes Commit: b1ab9e914193495b2301b5b1d85d7a47fc2cb81e Parents: ace4d32 Author: Francesco ChicchiriccòAuthored: Thu Dec 3 14:34:30 2015 +0100 Committer: Francesco Chicchiriccò Committed: Thu Dec 3 14:34:30 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 89 +++- 1 file changed, 87 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/b1ab9e91/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index 55054da..bba367f 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -21,9 +21,18 @@ package org.apache.cxf.jaxrs.swagger; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import javax.ws.rs.BeanParam; import javax.ws.rs.MatrixParam; @@ -38,6 +47,7 @@ import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -115,6 +125,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { // since downstream processors won't know how to introspect @BeanParam, process here for (Parameter param : extracted) { if (ParameterProcessor.applyAnnotations(null, param, paramType, paramAnnotations) != null) { +applyBeanValidatorAnnotations(param, paramAnnotations); parameters.add(param); } } @@ -130,11 +141,11 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { return parameters; } -private Property createProperty(Type type) { +private Property createProperty(final Type type) { return enforcePrimitive(ModelConverters.getInstance().readAsProperty(type), 0); } -private Property enforcePrimitive(Property in, int level) { +private Property enforcePrimitive(final Property in, final int level) { if (in instanceof RefProperty) { return new StringProperty(); } @@ -148,4 +159,78 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { } return in; } + +/** + * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. + * + * @param property + * @param annotations + */ +private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +Map annos = new HashMap (); +if (annotations != null) { +for (Annotation annotation : annotations) { +annos.put(annotation.annotationType().getName(), annotation); +} +} +if (annos.containsKey(NotNull.class.getName())) { +property.setRequired(true); +} +if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { +Min min = (Min) annos.get(Min.class.getName()); +AbstractNumericProperty ap = (AbstractNumericProperty) property; +ap.setMinimum(new Double(min.value())); +} +if (annos.containsKey(Max.class.getName()) && property instanceof AbstractNumericProperty) { +Max max = (Max) annos.get(Max.class.getName()); +
[1/3] cxf git commit: [CXF-6695] Handling bean validation annotations for @BeanParam fields
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes ace4d3200 -> b1ab9e914 refs/heads/3.1.x-fixes 45e0f05ed -> d4841e0b7 refs/heads/master 1f608e3e3 -> 70298efb5 [CXF-6695] Handling bean validation annotations for @BeanParam fields Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d4841e0b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d4841e0b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d4841e0b Branch: refs/heads/3.1.x-fixes Commit: d4841e0b7167685d50416317c19675fa386a53e9 Parents: 45e0f05 Author: Francesco ChicchiriccòAuthored: Thu Dec 3 14:30:45 2015 +0100 Committer: Francesco Chicchiriccò Committed: Thu Dec 3 14:31:19 2015 +0100 -- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 89 +++- 1 file changed, 87 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/d4841e0b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index 3c8ae95..b89a5e9 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -21,9 +21,18 @@ package org.apache.cxf.jaxrs.swagger; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import javax.ws.rs.BeanParam; import javax.ws.rs.MatrixParam; @@ -38,6 +47,7 @@ import io.swagger.jaxrs.ext.AbstractSwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtension; import io.swagger.jaxrs.ext.SwaggerExtensions; import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.AbstractNumericProperty; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; @@ -115,6 +125,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { // since downstream processors won't know how to introspect @BeanParam, process here for (Parameter param : extracted) { if (ParameterProcessor.applyAnnotations(null, param, paramType, paramAnnotations) != null) { +applyBeanValidatorAnnotations(param, paramAnnotations); parameters.add(param); } } @@ -130,11 +141,11 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { return parameters; } -private Property createProperty(Type type) { +private Property createProperty(final Type type) { return enforcePrimitive(ModelConverters.getInstance().readAsProperty(type), 0); } -private Property enforcePrimitive(Property in, int level) { +private Property enforcePrimitive(final Property in, final int level) { if (in instanceof RefProperty) { return new StringProperty(); } @@ -148,4 +159,78 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { } return in; } + +/** + * This is essentially a duplicate of {@link io.swagger.jackson.ModelResolver.applyBeanValidatorAnnotations}. + * + * @param property + * @param annotations + */ +private void applyBeanValidatorAnnotations(final Parameter property, final List annotations) { +Map annos = new HashMap<>(); +if (annotations != null) { +for (Annotation annotation : annotations) { +annos.put(annotation.annotationType().getName(), annotation); +} +} +if (annos.containsKey(NotNull.class.getName())) { +property.setRequired(true); +} +if (annos.containsKey(Min.class.getName()) && property instanceof AbstractNumericProperty) { +Min min = (Min) annos.get(Min.class.getName()); +AbstractNumericProperty ap = (AbstractNumericProperty) property; +ap.setMinimum(new Double(min.value())); +} +if
cxf git commit: Adding JAX-RS 2 extension for handling @BeanParam and @MatrixParam
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 2f5f034b8 -> cc591f4a3 Adding JAX-RS 2 extension for handling @BeanParam and @MatrixParam Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/cc591f4a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/cc591f4a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/cc591f4a Branch: refs/heads/3.1.x-fixes Commit: cc591f4a3b205a5dae58cadb79828d524a424513 Parents: 2f5f034 Author: Francesco ChicchiriccòAuthored: Mon Nov 30 16:13:17 2015 +0100 Committer: Francesco Chicchiriccò Committed: Tue Dec 1 12:00:20 2015 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 151 +++ .../cxf/jaxrs/swagger/MatrixParameter.java | 28 .../io.swagger.jaxrs.ext.SwaggerExtension | 1 + .../cxf/jaxrs/swagger/SwaggerUtilsTest.java | 6 +- .../src/test/resources/swagger20.json | 15 +- 6 files changed, 200 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/cc591f4a/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 210c0b0..8ca9fdb 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -144,7 +144,7 @@ 1.2.1 1.3.1.RELEASE spring-test -1.3.12 +1.3.13 1.5.4 1.7 4.4.1 http://git-wip-us.apache.org/repos/asf/cxf/blob/cc591f4a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java new file mode 100644 index 000..3c8ae95 --- /dev/null +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -0,0 +1,151 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.ws.rs.BeanParam; +import javax.ws.rs.MatrixParam; + +import com.fasterxml.jackson.databind.BeanDescription; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.introspect.AnnotatedField; +import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; +import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; + +import io.swagger.converter.ModelConverters; +import io.swagger.jaxrs.ext.AbstractSwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.Property; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.StringProperty; +import io.swagger.util.Json; +import io.swagger.util.ParameterProcessor; + +public class JaxRs2Extension extends AbstractSwaggerExtension { + +private final ObjectMapper mapper = Json.mapper(); + +@Override +public List extractParameters( +final List annotations, +final Type type, +final Set typesToSkip, +final Iterator chain) { + +if (shouldIgnoreType(type, typesToSkip)) { +return new ArrayList<>(); +} + +List parameters = new ArrayList<>(); +for (Annotation annotation : annotations) { +if (annotation instanceof MatrixParam) { +MatrixParam param = (MatrixParam) annotation; +MatrixParameter mp = new MatrixParameter().name(param.value()); + +Property schema = createProperty(type); +if (schema != null) { +
[1/2] cxf git commit: [CXF-6695] Adding JAX-RS 2 extension for handling @BeanParam and @MatrixParam
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 1c635e00a -> 3ff04d2b4 refs/heads/master c6b6c5766 -> ec15e3580 [CXF-6695] Adding JAX-RS 2 extension for handling @BeanParam and @MatrixParam Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ec15e358 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ec15e358 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ec15e358 Branch: refs/heads/master Commit: ec15e35805cf21c03d9eb922241ed4c02419c7e2 Parents: c6b6c57 Author: Francesco ChicchiriccòAuthored: Mon Nov 30 16:13:17 2015 +0100 Committer: Francesco Chicchiriccò Committed: Tue Dec 1 11:16:11 2015 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 151 +++ .../cxf/jaxrs/swagger/MatrixParameter.java | 28 .../io.swagger.jaxrs.ext.SwaggerExtension | 1 + .../cxf/jaxrs/swagger/SwaggerUtilsTest.java | 6 +- .../src/test/resources/swagger20.json | 15 +- 6 files changed, 200 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ec15e358/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index ebecbd9..3df4832 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -144,7 +144,7 @@ 1.2.1 1.3.1.RELEASE spring-test -1.3.12 +1.3.13 1.5.4 1.7 4.4.1 http://git-wip-us.apache.org/repos/asf/cxf/blob/ec15e358/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java new file mode 100644 index 000..3c8ae95 --- /dev/null +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -0,0 +1,151 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.ws.rs.BeanParam; +import javax.ws.rs.MatrixParam; + +import com.fasterxml.jackson.databind.BeanDescription; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.introspect.AnnotatedField; +import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; +import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; + +import io.swagger.converter.ModelConverters; +import io.swagger.jaxrs.ext.AbstractSwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.Property; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.StringProperty; +import io.swagger.util.Json; +import io.swagger.util.ParameterProcessor; + +public class JaxRs2Extension extends AbstractSwaggerExtension { + +private final ObjectMapper mapper = Json.mapper(); + +@Override +public List extractParameters( +final List annotations, +final Type type, +final Set typesToSkip, +final Iterator chain) { + +if (shouldIgnoreType(type, typesToSkip)) { +return new ArrayList<>(); +} + +List parameters = new ArrayList<>(); +for (Annotation annotation : annotations) { +if (annotation instanceof MatrixParam) { +MatrixParam param = (MatrixParam) annotation; +MatrixParameter mp = new MatrixParameter().name(param.value()); + +Property schema =
[2/2] cxf git commit: [CXF-6695] Adding JAX-RS 2 extension for handling @BeanParam
[CXF-6695] Adding JAX-RS 2 extension for handling @BeanParam Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3ff04d2b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3ff04d2b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3ff04d2b Branch: refs/heads/3.0.x-fixes Commit: 3ff04d2b458b867ea6437a7ed9949d834b16e346 Parents: 1c635e0 Author: Francesco ChicchiriccòAuthored: Tue Dec 1 11:59:35 2015 +0100 Committer: Francesco Chicchiriccò Committed: Tue Dec 1 11:59:35 2015 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/JaxRs2Extension.java | 151 +++ .../cxf/jaxrs/swagger/MatrixParameter.java | 28 .../io.swagger.jaxrs.ext.SwaggerExtension | 1 + .../cxf/jaxrs/swagger/SwaggerUtilsTest.java | 6 +- .../src/test/resources/swagger20.json | 15 +- 6 files changed, 200 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/3ff04d2b/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 5c696e3..ee9b504 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -158,7 +158,7 @@ 1.2.1 1.3.1.RELEASE spring-test -1.3.12 +1.3.13 1.5.4 1.7 4.4.1 http://git-wip-us.apache.org/repos/asf/cxf/blob/3ff04d2b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java new file mode 100644 index 000..55054da --- /dev/null +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -0,0 +1,151 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.ws.rs.BeanParam; +import javax.ws.rs.MatrixParam; + +import com.fasterxml.jackson.databind.BeanDescription; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.introspect.AnnotatedField; +import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; +import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; + +import io.swagger.converter.ModelConverters; +import io.swagger.jaxrs.ext.AbstractSwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtension; +import io.swagger.jaxrs.ext.SwaggerExtensions; +import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.Property; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.StringProperty; +import io.swagger.util.Json; +import io.swagger.util.ParameterProcessor; + +public class JaxRs2Extension extends AbstractSwaggerExtension { + +private final ObjectMapper mapper = Json.mapper(); + +@Override +public List extractParameters( +final List annotations, +final Type type, +final Set typesToSkip, +final Iterator chain) { + +if (shouldIgnoreType(type, typesToSkip)) { +return new ArrayList(); +} + +List parameters = new ArrayList(); +for (Annotation annotation : annotations) { +if (annotation instanceof MatrixParam) { +MatrixParam param = (MatrixParam) annotation; +MatrixParameter mp = new MatrixParameter().name(param.value()); + +Property schema = createProperty(type); +if (schema != null) { +mp.setProperty(schema); +} +parameters.add(mp); +
[2/2] cxf git commit: Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension
Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e515c136 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e515c136 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e515c136 Branch: refs/heads/3.0.x-fixes Commit: e515c136504d2854a6db42c5351adf7aa00cddb3 Parents: 0afa9d2 Author: Francesco ChicchiriccòAuthored: Wed Mar 16 16:40:02 2016 +0100 Committer: Francesco Chicchiriccò Committed: Wed Mar 16 16:40:02 2016 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/Swagger2Feature.java | 82 .../cxf/jaxrs/swagger/Swagger2Serializers.java | 14 ++-- 3 files changed, 57 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/e515c136/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 1a49ffa..18abcc7 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -159,7 +159,7 @@ 1.3.1.RELEASE spring-test 1.3.13 -1.5.4 +1.5.8 1.7 4.4.1 3.1.4 http://git-wip-us.apache.org/repos/asf/cxf/blob/e515c136/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java index 701701b..df5ea1e 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java @@ -32,6 +32,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @@ -44,6 +45,7 @@ import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.jaxrs.utils.InjectionUtils; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.config.DefaultReaderConfig; @@ -52,6 +54,12 @@ import io.swagger.jaxrs.listing.ApiListingResource; public class Swagger2Feature extends AbstractSwaggerFeature { +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + private String host; private String[] schemes; @@ -62,33 +70,24 @@ public class Swagger2Feature extends AbstractSwaggerFeature { private String ignoreRoutes; -private boolean dynamicBasePath; - -private boolean replaceTags; - -private DocumentationProvider javadocProvider; - @Override protected void addSwaggerResource(Server server) { -List cris = Collections.emptyList(); -if (!runAsFilter) { -List serviceBeans = new ArrayList(); -ApiListingResource apiListingResource = new ApiListingResource(); -serviceBeans.add(apiListingResource); -JAXRSServiceFactoryBean sfb = -(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); -sfb.setResourceClassesFromBeans(serviceBeans); -cris = sfb.getClassResourceInfo(); +ApiListingResource apiListingResource = new ApiListingResource(); +JAXRSServiceFactoryBean sfb = +(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); + sfb.setResourceClassesFromBeans(Collections.singletonList(apiListingResource)); +List cris = sfb.getClassResourceInfo(); + +List providers = new ArrayList(); +if (runAsFilter) { +providers.add(new SwaggerContainerRequestFilter()); +} else { for (ClassResourceInfo cri : cris) { if (ApiListingResource.class == cri.getResourceClass()) { -InjectionUtils.injectContextProxiesAndApplication(cri, apiListingResource, null); +InjectionUtils.injectContextProxies(cri, apiListingResource); } } } -List providers = new ArrayList(); -if (runAsFilter) { -providers.add(new SwaggerContainerRequestFilter()); -}
cxf git commit: Fixing Sagger2 systests
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 5d0ac9e12 -> e3ce885aa Fixing Sagger2 systests Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e3ce885a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e3ce885a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e3ce885a Branch: refs/heads/3.1.x-fixes Commit: e3ce885aaf241dee8c163568199adc4b6aa51805 Parents: 5d0ac9e Author: Francesco ChicchiriccòAuthored: Fri Mar 18 15:51:13 2016 +0100 Committer: Francesco Chicchiriccò Committed: Fri Mar 18 17:15:10 2016 +0100 -- .../AbstractSwagger2ServiceDescriptionTest.java | 1 + ...gger2NonAnnotatedServiceDescriptionTest.java | 2 +- .../jaxrs/description/swagger2-noano-yaml.txt | 4 ++- .../systest/jaxrs/description/swagger2-yaml.txt | 33 ++-- 4 files changed, 36 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/e3ce885a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java index 3332f47..bf4b168 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java @@ -55,6 +55,7 @@ public abstract class AbstractSwagger2ServiceDescriptionTest extends AbstractBus this.runAsFilter = runAsFilter; } +@Override protected void run() { final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses(BookStoreSwagger2.class); http://git-wip-us.apache.org/repos/asf/cxf/blob/e3ce885a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java index f47af93..dd56fe2 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java @@ -77,6 +77,6 @@ public class Swagger2NonAnnotatedServiceDescriptionTest extends AbstractSwagger2 @Override protected String getExpectedFileYaml() { -return "swagger2-noano-json.txt"; +return "swagger2-noano-yaml.txt"; } } http://git-wip-us.apache.org/repos/asf/cxf/blob/e3ce885a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt -- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt index 8bd33ee..5ef0eb4 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt @@ -29,12 +29,14 @@ paths: /bookstore/names: get: operationId: "getBookNames" + produces: + - "application/json" parameters: - name: "page" in: "query" required: false type: "integer" -default: "1" +default: 1 format: "int32" responses: default: http://git-wip-us.apache.org/repos/asf/cxf/blob/e3ce885a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt -- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt index 75c34d0..1947c41 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt @@ -29,7 +29,7 @@ paths: description: "Page
cxf git commit: Fixing Sagger2 systests
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes d13b22b37 -> f49297cff Fixing Sagger2 systests Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f49297cf Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f49297cf Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f49297cf Branch: refs/heads/3.0.x-fixes Commit: f49297cffa234d2838106bad65869fb57068c95a Parents: d13b22b Author: Francesco ChicchiriccòAuthored: Fri Mar 18 15:51:13 2016 +0100 Committer: Francesco Chicchiriccò Committed: Fri Mar 18 17:14:55 2016 +0100 -- .../AbstractSwagger2ServiceDescriptionTest.java | 1 + ...gger2NonAnnotatedServiceDescriptionTest.java | 2 +- .../jaxrs/description/swagger2-noano-yaml.txt | 4 ++- .../systest/jaxrs/description/swagger2-yaml.txt | 33 ++-- 4 files changed, 36 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/f49297cf/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java index 3332f47..bf4b168 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java @@ -55,6 +55,7 @@ public abstract class AbstractSwagger2ServiceDescriptionTest extends AbstractBus this.runAsFilter = runAsFilter; } +@Override protected void run() { final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses(BookStoreSwagger2.class); http://git-wip-us.apache.org/repos/asf/cxf/blob/f49297cf/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java index f47af93..dd56fe2 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java @@ -77,6 +77,6 @@ public class Swagger2NonAnnotatedServiceDescriptionTest extends AbstractSwagger2 @Override protected String getExpectedFileYaml() { -return "swagger2-noano-json.txt"; +return "swagger2-noano-yaml.txt"; } } http://git-wip-us.apache.org/repos/asf/cxf/blob/f49297cf/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt -- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt index 8bd33ee..5ef0eb4 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-noano-yaml.txt @@ -29,12 +29,14 @@ paths: /bookstore/names: get: operationId: "getBookNames" + produces: + - "application/json" parameters: - name: "page" in: "query" required: false type: "integer" -default: "1" +default: 1 format: "int32" responses: default: http://git-wip-us.apache.org/repos/asf/cxf/blob/f49297cf/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt -- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt index 75c34d0..1947c41 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-yaml.txt @@ -29,7 +29,7 @@ paths: description: "Page
cxf git commit: Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes d7e2821f8 -> 7a35d3314 Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7a35d331 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7a35d331 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7a35d331 Branch: refs/heads/3.1.x-fixes Commit: 7a35d33145a7d1f2d00d01df130f836127d65f62 Parents: d7e2821 Author: Francesco ChicchiriccòAuthored: Wed Mar 16 16:09:17 2016 +0100 Committer: Francesco Chicchiriccò Committed: Wed Mar 16 16:40:33 2016 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/Swagger2Feature.java | 82 .../cxf/jaxrs/swagger/Swagger2Serializers.java | 10 +-- 3 files changed, 55 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/7a35d331/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index c50a51f..ccf6de9 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -146,7 +146,7 @@ 1.3.1.RELEASE spring-test 1.3.13 -1.5.4 +1.5.8 1.7 4.4.1 3.1.4 http://git-wip-us.apache.org/repos/asf/cxf/blob/7a35d331/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java index 5072104..bc9102f 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java @@ -32,6 +32,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @@ -46,6 +47,7 @@ import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.jaxrs.utils.InjectionUtils; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.config.DefaultReaderConfig; @@ -55,6 +57,12 @@ import io.swagger.jaxrs.listing.ApiListingResource; @Provider(Type.Feature) public class Swagger2Feature extends AbstractSwaggerFeature { +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + private String host; private String[] schemes; @@ -65,33 +73,24 @@ public class Swagger2Feature extends AbstractSwaggerFeature { private String ignoreRoutes; -private boolean dynamicBasePath; - -private boolean replaceTags; - -private DocumentationProvider javadocProvider; - @Override protected void addSwaggerResource(Server server) { -List cris = Collections.emptyList(); -if (!runAsFilter) { -List serviceBeans = new ArrayList<>(); -ApiListingResource apiListingResource = new ApiListingResource(); -serviceBeans.add(apiListingResource); -JAXRSServiceFactoryBean sfb = -(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); -sfb.setResourceClassesFromBeans(serviceBeans); -cris = sfb.getClassResourceInfo(); +ApiListingResource apiListingResource = new ApiListingResource(); +JAXRSServiceFactoryBean sfb = +(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); + sfb.setResourceClassesFromBeans(Collections.singletonList(apiListingResource)); +List cris = sfb.getClassResourceInfo(); + +List providers = new ArrayList<>(); +if (runAsFilter) { +providers.add(new SwaggerContainerRequestFilter()); +} else { for (ClassResourceInfo cri : cris) { if (ApiListingResource.class == cri.getResourceClass()) { -InjectionUtils.injectContextProxiesAndApplication(cri, apiListingResource, null); +InjectionUtils.injectContextProxies(cri, apiListingResource); } } } -List providers = new
[1/2] cxf git commit: Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 0afa9d25d -> e515c1365 refs/heads/master bafe76605 -> 7098ccba6 Several Swagger-related improvements: swagger-jaxrs upgraded to 1.5.8, now working properly even as filter, prepared Swagger2Feature for extension Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7098ccba Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7098ccba Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7098ccba Branch: refs/heads/master Commit: 7098ccba6b70f911fa7056979b94324fe6104522 Parents: bafe766 Author: Francesco ChicchiriccòAuthored: Wed Mar 16 16:09:17 2016 +0100 Committer: Francesco Chicchiriccò Committed: Wed Mar 16 16:18:35 2016 +0100 -- parent/pom.xml | 2 +- .../cxf/jaxrs/swagger/Swagger2Feature.java | 82 .../cxf/jaxrs/swagger/Swagger2Serializers.java | 10 +-- 3 files changed, 55 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/7098ccba/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 0815e51..864df71 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -148,7 +148,7 @@ 1.3.1.RELEASE spring-test 1.3.13 -1.5.4 +1.5.8 1.7 4.4.1 3.1.4 http://git-wip-us.apache.org/repos/asf/cxf/blob/7098ccba/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java index 5072104..bc9102f 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java @@ -32,6 +32,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @@ -46,6 +47,7 @@ import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.jaxrs.utils.InjectionUtils; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.config.DefaultReaderConfig; @@ -55,6 +57,12 @@ import io.swagger.jaxrs.listing.ApiListingResource; @Provider(Type.Feature) public class Swagger2Feature extends AbstractSwaggerFeature { +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + private String host; private String[] schemes; @@ -65,33 +73,24 @@ public class Swagger2Feature extends AbstractSwaggerFeature { private String ignoreRoutes; -private boolean dynamicBasePath; - -private boolean replaceTags; - -private DocumentationProvider javadocProvider; - @Override protected void addSwaggerResource(Server server) { -List cris = Collections.emptyList(); -if (!runAsFilter) { -List serviceBeans = new ArrayList<>(); -ApiListingResource apiListingResource = new ApiListingResource(); -serviceBeans.add(apiListingResource); -JAXRSServiceFactoryBean sfb = -(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); -sfb.setResourceClassesFromBeans(serviceBeans); -cris = sfb.getClassResourceInfo(); +ApiListingResource apiListingResource = new ApiListingResource(); +JAXRSServiceFactoryBean sfb = +(JAXRSServiceFactoryBean) server.getEndpoint().get(JAXRSServiceFactoryBean.class.getName()); + sfb.setResourceClassesFromBeans(Collections.singletonList(apiListingResource)); +List cris = sfb.getClassResourceInfo(); + +List providers = new ArrayList<>(); +if (runAsFilter) { +providers.add(new SwaggerContainerRequestFilter()); +} else { for (ClassResourceInfo cri : cris) { if (ApiListingResource.class == cri.getResourceClass()) { -InjectionUtils.injectContextProxiesAndApplication(cri, apiListingResource, null); +InjectionUtils.injectContextProxies(cri, apiListingResource); } } }
cxf git commit: Fixing Sagger2 systests
Repository: cxf Updated Branches: refs/heads/master ea618d7af -> 4799fef82 Fixing Sagger2 systests Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4799fef8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4799fef8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4799fef8 Branch: refs/heads/master Commit: 4799fef822a96f5d1b2827d5cc42ab886fd4e673 Parents: ea618d7 Author: Francesco ChicchiriccòAuthored: Fri Mar 18 15:51:13 2016 +0100 Committer: Francesco Chicchiriccò Committed: Fri Mar 18 17:14:29 2016 +0100 -- .../AbstractSwagger2ServiceDescriptionTest.java | 1 + ...gger2NonAnnotatedServiceDescriptionTest.java | 2 +- .../systest/jaxrs/description/swagger2-json.txt | 2 +- .../jaxrs/description/swagger2-noano-yaml.txt | 4 +- .../systest/jaxrs/description/swagger2-yaml.txt | 51 5 files changed, 37 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/4799fef8/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java index 3332f47..bf4b168 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/AbstractSwagger2ServiceDescriptionTest.java @@ -55,6 +55,7 @@ public abstract class AbstractSwagger2ServiceDescriptionTest extends AbstractBus this.runAsFilter = runAsFilter; } +@Override protected void run() { final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses(BookStoreSwagger2.class); http://git-wip-us.apache.org/repos/asf/cxf/blob/4799fef8/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java -- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java index f47af93..dd56fe2 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/Swagger2NonAnnotatedServiceDescriptionTest.java @@ -77,6 +77,6 @@ public class Swagger2NonAnnotatedServiceDescriptionTest extends AbstractSwagger2 @Override protected String getExpectedFileYaml() { -return "swagger2-noano-json.txt"; +return "swagger2-noano-yaml.txt"; } } http://git-wip-us.apache.org/repos/asf/cxf/blob/4799fef8/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-json.txt -- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-json.txt b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-json.txt index a1317de..0df74e4 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-json.txt +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/description/swagger2-json.txt @@ -1 +1 @@ -{"swagger":"2.0","info":{"description":"The Application","version":"1.0.0","title":"Sample REST Application","contact":{"name":"us...@cxf.apache.org"},"license":{"name":"Apache 2.0 License","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"localhost:%s","basePath":"/","tags":[{"name":"bookstore"}],"paths":{"/bookstore":{"get":{"tags":["bookstore"],"summary":"Get books","description":"Get books","operationId":"getBooks","produces":["application/json"],"parameters":[{"name":"page","in":"query","description":"Page to fetch","required":true,"type":"integer","default":1,"format":"int32"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Book"}},"/bookstore/{id}":{"get":{"tags":["bookstore"],"summary":"Get book by Id","description":"Get book by Id","operationId":"getBook","produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"id","required":true,"type":"integer","format":"int
[2/2] cxf git commit: [CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures
[CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b20a66cc Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b20a66cc Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b20a66cc Branch: refs/heads/3.0.x-fixes Commit: b20a66cc33837ad52535cf11778dd3f81825dc84 Parents: ff8b78e Author: Francesco ChicchiriccòAuthored: Mon Apr 4 12:58:09 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Apr 4 12:58:09 2016 +0200 -- .../main/java/org/apache/cxf/message/MessageUtils.java | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/b20a66cc/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index b7f8137..5bcfe23 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,10 +42,13 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -return message != null - && message.getExchange() != null - && (message == message.getExchange().getOutMessage() -|| message == message.getExchange().getOutFaultMessage()); +if (message == null) { +return false; +} + +Exchange exchange = message.getExchange(); +return exchange != null + && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); } /**
cxf git commit: [CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures
Repository: cxf Updated Branches: refs/heads/master 8b3b47773 -> 3a8661b2f [CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3a8661b2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3a8661b2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3a8661b2 Branch: refs/heads/master Commit: 3a8661b2f3156e9889dff3986461033f3f5b0f19 Parents: 8b3b477 Author: Francesco ChicchiriccòAuthored: Mon Apr 4 12:57:17 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Apr 4 12:58:35 2016 +0200 -- .../main/java/org/apache/cxf/message/MessageUtils.java | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/3a8661b2/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index b7f8137..5bcfe23 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,10 +42,13 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -return message != null - && message.getExchange() != null - && (message == message.getExchange().getOutMessage() -|| message == message.getExchange().getOutFaultMessage()); +if (message == null) { +return false; +} + +Exchange exchange = message.getExchange(); +return exchange != null + && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); } /**
[1/2] cxf git commit: [CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes ff8b78ea9 -> b20a66cc3 refs/heads/3.1.x-fixes f7641bc29 -> 82fba2c5f [CXF-6845] Partially reverting the change in MessageUtils#isOutbound due to test failures Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/82fba2c5 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/82fba2c5 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/82fba2c5 Branch: refs/heads/3.1.x-fixes Commit: 82fba2c5f2ec13773397b823127d29856dea174d Parents: f7641bc Author: Francesco ChicchiriccòAuthored: Mon Apr 4 12:57:42 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Apr 4 12:57:42 2016 +0200 -- .../main/java/org/apache/cxf/message/MessageUtils.java | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/82fba2c5/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index b7f8137..5bcfe23 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,10 +42,13 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -return message != null - && message.getExchange() != null - && (message == message.getExchange().getOutMessage() -|| message == message.getExchange().getOutFaultMessage()); +if (message == null) { +return false; +} + +Exchange exchange = message.getExchange(); +return exchange != null + && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); } /**
[1/3] cxf git commit: [CXF-6845] More non-null checks
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes c633fbccb -> ca618c41b refs/heads/3.1.x-fixes 6c9b9b922 -> 87bbc7f81 refs/heads/master 19c1279dc -> b34ec6ea1 [CXF-6845] More non-null checks Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ca618c41 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ca618c41 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ca618c41 Branch: refs/heads/3.0.x-fixes Commit: ca618c41b9c734e8ea6edb13fd171d66ddeeb7fc Parents: c633fbc Author: Francesco ChicchiriccòAuthored: Tue Mar 29 12:31:23 2016 +0200 Committer: Francesco Chicchiriccò Committed: Tue Mar 29 12:31:23 2016 +0200 -- .../org/apache/cxf/message/MessageUtils.java| 37 1 file changed, 23 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ca618c41/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index d8bbf0c..b7f8137 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,9 +42,10 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -Exchange exchange = message.getExchange(); -return exchange != null - && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); +return message != null + && message.getExchange() != null + && (message == message.getExchange().getOutMessage() +|| message == message.getExchange().getOutFaultMessage()); } /** @@ -88,8 +89,11 @@ public final class MessageUtils { * @return true if the current messaging role is that of requestor */ public static boolean isRequestor(Message message) { -Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE); -return requestor != null && requestor.booleanValue(); +if (message != null) { +Boolean requestor = (Boolean) message.get(Message.REQUESTOR_ROLE); +return requestor != null && requestor; +} +return false; } /** @@ -99,7 +103,7 @@ public final class MessageUtils { * @return true if the current messags is a partial response */ public static boolean isPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); } /** @@ -110,7 +114,7 @@ public final class MessageUtils { * @return true if the current messags is a partial empty response */ public static boolean isEmptyPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); } /** @@ -124,17 +128,22 @@ public final class MessageUtils { } public static boolean getContextualBoolean(Message m, String key, boolean defaultValue) { -Object o = m.getContextualProperty(key); -if (o != null) { -return PropertyUtils.isTrue(o); +if (m != null) { +Object o = m.getContextualProperty(key); +if (o != null) { +return PropertyUtils.isTrue(o); +} } return defaultValue; } public static Object getContextualProperty(Message m, String propPreferred, String propDefault) { -Object prop = m.getContextualProperty(propPreferred); -if (prop == null && propDefault != null) { -prop = m.getContextualProperty(propDefault); +Object prop = null; +if (m != null) { +prop = m.getContextualProperty(propPreferred); +if (prop == null && propDefault != null) { +prop = m.getContextualProperty(propDefault); +} } return prop; } @@ -143,7 +152,7 @@ public final class MessageUtils { * Returns true if the underlying content format is a W3C DOM or a SAAJ message. */ public static boolean isDOMPresent(Message m) { -return m.getContent(Node.class) != null; +return m != null && m.getContent(Node.class) != null; /* for (Class c : m.getContentFormats()) { if (c.equals(Node.class) ||
[3/3] cxf git commit: [CXF-6845] More non-null checks
[CXF-6845] More non-null checks Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b34ec6ea Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b34ec6ea Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b34ec6ea Branch: refs/heads/master Commit: b34ec6ea11bda11a6072574d30df36b4c72eb581 Parents: 19c1279 Author: Francesco ChicchiriccòAuthored: Tue Mar 29 12:35:37 2016 +0200 Committer: Francesco Chicchiriccò Committed: Tue Mar 29 12:35:37 2016 +0200 -- .../org/apache/cxf/message/MessageUtils.java| 29 1 file changed, 18 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/b34ec6ea/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index d964070..b7f8137 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,9 +42,10 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -Exchange exchange = message.getExchange(); -return exchange != null - && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); +return message != null + && message.getExchange() != null + && (message == message.getExchange().getOutMessage() +|| message == message.getExchange().getOutFaultMessage()); } /** @@ -88,8 +89,11 @@ public final class MessageUtils { * @return true if the current messaging role is that of requestor */ public static boolean isRequestor(Message message) { -Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE); -return requestor != null && requestor.booleanValue(); +if (message != null) { +Boolean requestor = (Boolean) message.get(Message.REQUESTOR_ROLE); +return requestor != null && requestor; +} +return false; } /** @@ -99,7 +103,7 @@ public final class MessageUtils { * @return true if the current messags is a partial response */ public static boolean isPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); } /** @@ -110,7 +114,7 @@ public final class MessageUtils { * @return true if the current messags is a partial empty response */ public static boolean isEmptyPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); } /** @@ -134,9 +138,12 @@ public final class MessageUtils { } public static Object getContextualProperty(Message m, String propPreferred, String propDefault) { -Object prop = m.getContextualProperty(propPreferred); -if (prop == null && propDefault != null) { -prop = m.getContextualProperty(propDefault); +Object prop = null; +if (m != null) { +prop = m.getContextualProperty(propPreferred); +if (prop == null && propDefault != null) { +prop = m.getContextualProperty(propDefault); +} } return prop; } @@ -145,7 +152,7 @@ public final class MessageUtils { * Returns true if the underlying content format is a W3C DOM or a SAAJ message. */ public static boolean isDOMPresent(Message m) { -return m.getContent(Node.class) != null; +return m != null && m.getContent(Node.class) != null; /* for (Class c : m.getContentFormats()) { if (c.equals(Node.class) || c.getName().equals("javax.xml.soap.SOAPMessage")) {
[2/3] cxf git commit: [CXF-6845] More non-null checks
[CXF-6845] More non-null checks Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/87bbc7f8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/87bbc7f8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/87bbc7f8 Branch: refs/heads/3.1.x-fixes Commit: 87bbc7f8110fc2629aeb6a706e83392442ab0507 Parents: 6c9b9b9 Author: Francesco ChicchiriccòAuthored: Tue Mar 29 12:34:40 2016 +0200 Committer: Francesco Chicchiriccò Committed: Tue Mar 29 12:34:40 2016 +0200 -- .../org/apache/cxf/message/MessageUtils.java| 29 1 file changed, 18 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/87bbc7f8/core/src/main/java/org/apache/cxf/message/MessageUtils.java -- diff --git a/core/src/main/java/org/apache/cxf/message/MessageUtils.java b/core/src/main/java/org/apache/cxf/message/MessageUtils.java index d964070..b7f8137 100644 --- a/core/src/main/java/org/apache/cxf/message/MessageUtils.java +++ b/core/src/main/java/org/apache/cxf/message/MessageUtils.java @@ -42,9 +42,10 @@ public final class MessageUtils { * @return true if the message direction is outbound */ public static boolean isOutbound(Message message) { -Exchange exchange = message.getExchange(); -return exchange != null - && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); +return message != null + && message.getExchange() != null + && (message == message.getExchange().getOutMessage() +|| message == message.getExchange().getOutFaultMessage()); } /** @@ -88,8 +89,11 @@ public final class MessageUtils { * @return true if the current messaging role is that of requestor */ public static boolean isRequestor(Message message) { -Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE); -return requestor != null && requestor.booleanValue(); +if (message != null) { +Boolean requestor = (Boolean) message.get(Message.REQUESTOR_ROLE); +return requestor != null && requestor; +} +return false; } /** @@ -99,7 +103,7 @@ public final class MessageUtils { * @return true if the current messags is a partial response */ public static boolean isPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)); } /** @@ -110,7 +114,7 @@ public final class MessageUtils { * @return true if the current messags is a partial empty response */ public static boolean isEmptyPartialResponse(Message message) { -return Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); +return message != null && Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE)); } /** @@ -134,9 +138,12 @@ public final class MessageUtils { } public static Object getContextualProperty(Message m, String propPreferred, String propDefault) { -Object prop = m.getContextualProperty(propPreferred); -if (prop == null && propDefault != null) { -prop = m.getContextualProperty(propDefault); +Object prop = null; +if (m != null) { +prop = m.getContextualProperty(propPreferred); +if (prop == null && propDefault != null) { +prop = m.getContextualProperty(propDefault); +} } return prop; } @@ -145,7 +152,7 @@ public final class MessageUtils { * Returns true if the underlying content format is a W3C DOM or a SAAJ message. */ public static boolean isDOMPresent(Message m) { -return m.getContent(Node.class) != null; +return m != null && m.getContent(Node.class) != null; /* for (Class c : m.getContentFormats()) { if (c.equals(Node.class) || c.getName().equals("javax.xml.soap.SOAPMessage")) {
[2/3] cxf git commit: [CXF-6990] Sorting tag list before writing out
[CXF-6990] Sorting tag list before writing out Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/75ce1c4b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/75ce1c4b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/75ce1c4b Branch: refs/heads/3.0.x-fixes Commit: 75ce1c4bd7b08cad5ee0bc8684cd289bba06c975 Parents: 90f9a15 Author: Francesco ChicchiriccòAuthored: Thu Aug 4 11:46:38 2016 +0200 Committer: Francesco Chicchiriccò Committed: Thu Aug 4 11:46:38 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java | 10 ++ 1 file changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/75ce1c4b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java index c6dcdae..230489c 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java @@ -23,6 +23,7 @@ import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -142,6 +143,15 @@ public class Swagger2Serializers extends SwaggerSerializers { } } } +if (replaceTags && data.getTags() != null) { +Collections.sort(data.getTags(), new Comparator() { + +@Override +public int compare(final Tag tag1, final Tag tag2) { +return tag1.getName().compareTo(tag2.getName()); +} +}); +} super.writeTo(data, type, genericType, annotations, mediaType, headers, out); }
[3/3] cxf git commit: Sorting tag list before writing out
Sorting tag list before writing out Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/76400809 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/76400809 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/76400809 Branch: refs/heads/master Commit: 764008097bd14edc7531c990c4b056ab0a2dc040 Parents: bacef09 Author: Francesco ChicchiriccòAuthored: Thu Aug 4 11:38:43 2016 +0200 Committer: Francesco Chicchiriccò Committed: Thu Aug 4 11:47:17 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java | 10 ++ 1 file changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/76400809/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java -- diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java index e6f7be2..ae6dc27 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java @@ -23,6 +23,7 @@ import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -141,6 +142,15 @@ public class Swagger2Serializers extends SwaggerSerializers { } } } +if (replaceTags && data.getTags() != null) { +Collections.sort(data.getTags(), new Comparator() { + +@Override +public int compare(final Tag tag1, final Tag tag2) { +return tag1.getName().compareTo(tag2.getName()); +} +}); +} super.writeTo(data, type, genericType, annotations, mediaType, headers, out); }
[1/3] cxf git commit: [CXF-6990] Sorting tag list before writing out
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 90f9a1555 -> 75ce1c4bd refs/heads/3.1.x-fixes fd958fdbc -> 2bc15f89b refs/heads/master bacef091c -> 764008097 [CXF-6990] Sorting tag list before writing out Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2bc15f89 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2bc15f89 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2bc15f89 Branch: refs/heads/3.1.x-fixes Commit: 2bc15f89b93716aeaa7c37fc650a177408257a98 Parents: fd958fd Author: Francesco ChicchiriccòAuthored: Thu Aug 4 11:38:43 2016 +0200 Committer: Francesco Chicchiriccò Committed: Thu Aug 4 11:38:43 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java | 10 ++ 1 file changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/2bc15f89/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java -- diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java index e6f7be2..ae6dc27 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java @@ -23,6 +23,7 @@ import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -141,6 +142,15 @@ public class Swagger2Serializers extends SwaggerSerializers { } } } +if (replaceTags && data.getTags() != null) { +Collections.sort(data.getTags(), new Comparator() { + +@Override +public int compare(final Tag tag1, final Tag tag2) { +return tag1.getName().compareTo(tag2.getName()); +} +}); +} super.writeTo(data, type, genericType, annotations, mediaType, headers, out); }
[3/3] cxf git commit: [CXF-7022] Adding general addParameters() method, meant for extension
[CXF-7022] 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/503442f3 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/503442f3 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/503442f3 Branch: refs/heads/3.0.x-fixes Commit: 503442f3a33731341fdf58f25d97418d51e0e8ee Parents: 3649364 Author: Francesco ChicchiriccòAuthored: Mon Sep 5 17:52:17 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Sep 5 17:52:17 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 22 +++- 1 file changed, 21 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/503442f3/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java index c30d8bc..d9efb96 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java +++ b/rt/rs/description/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 cris; protected BeanConfig beanConfig; + @Override public void writeTo( final Swagger data, @@ -128,6 +130,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()) { @@ -169,6 +172,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 parameters) { +// does nothing by default +} + @Override public void setDynamicBasePath(final boolean dynamicBasePath) { this.dynamicBasePath = dynamicBasePath; @@ -182,6 +201,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw this.javadocProvider = javadocProvider; } +@Override public void setClassResourceInfos(final List classResourceInfos) { this.cris = classResourceInfos; } @@ -201,6 +221,6 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw @Override public void setBeanConfig(BeanConfig beanConfig) { this.beanConfig = beanConfig; - + } }
[1/3] cxf git commit: [CXF-7022] Adding general addParameters() method, meant for extension
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 364936442 -> 503442f3a refs/heads/3.1.x-fixes 61349a507 -> fc2c300d3 refs/heads/master ea1abeeb2 -> d16270849 [CXF-7022] 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/fc2c300d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fc2c300d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fc2c300d Branch: refs/heads/3.1.x-fixes Commit: fc2c300d3ca3ba695005de100703bd8bd74f3adb Parents: 61349a5 Author: Francesco ChicchiriccòAuthored: Mon Sep 5 17:43:42 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Sep 5 17:43:42 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 22 +++- 1 file changed, 21 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/fc2c300d/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 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 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 classResourceInfos) { this.cris = classResourceInfos; } @@ -200,6 +220,6 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw @Override public void setBeanConfig(BeanConfig beanConfig) { this.beanConfig = beanConfig; - + } }
[2/3] cxf git commit: Adding general addParameters() method, meant for extension
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: d16270849175faa162ee8c13194765eb677b Parents: ea1abee Author: Francesco ChicchiriccòAuthored: Mon Sep 5 17:43:42 2016 +0200 Committer: Francesco Chicchiriccò 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 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 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 classResourceInfos) { this.cris = classResourceInfos; } @@ -200,6 +220,6 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw @Override public void setBeanConfig(BeanConfig beanConfig) { this.beanConfig = beanConfig; - + } }
cxf git commit: [CXF-7022] Adding general addParameters() method, meant for extension [Forced Update!]
Repository: cxf Updated Branches: refs/heads/master d16270849 -> e1fe28c72 (forced update) [CXF-7022] 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/e1fe28c7 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e1fe28c7 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e1fe28c7 Branch: refs/heads/master Commit: e1fe28c725ad123347e0716556272c15345ca274 Parents: ea1abee Author: Francesco ChicchiriccòAuthored: Mon Sep 5 17:43:42 2016 +0200 Committer: Francesco Chicchiriccò Committed: Mon Sep 5 17:54:39 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 22 +++- 1 file changed, 21 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/e1fe28c7/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 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 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 classResourceInfos) { this.cris = classResourceInfos; } @@ -200,6 +220,6 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw @Override public void setBeanConfig(BeanConfig beanConfig) { this.beanConfig = beanConfig; - + } }
[3/3] cxf git commit: Fixing behavior with subresources and newer Swagger UI
Fixing behavior with subresources and newer Swagger UI Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a6c934ba Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a6c934ba Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a6c934ba Branch: refs/heads/3.0.x-fixes Commit: a6c934ba238f76da93642014b7dd326a31b2b8d4 Parents: ec80c24 Author: Francesco ChicchiriccòAuthored: Fri Sep 23 13:40:20 2016 +0200 Committer: Francesco Chicchiriccò Committed: Fri Sep 23 13:40:20 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/a6c934ba/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java index d9efb96..560926f 100644 --- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -107,8 +107,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw ClassResourceInfo cri = operations.get(entry.getKey()); tag = new Tag(); -String tagName = StringUtils.removeStart(cri.getURITemplate().getValue(), "/"); -tag.setName(StringUtils.isEmpty(tagName) ? "_" : tagName); + tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri)); }
[1/3] cxf git commit: Fixing behavior with subresources and newer Swagger UI
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes ec80c2414 -> a6c934ba2 refs/heads/3.1.x-fixes 0947c0a20 -> d345b60a4 refs/heads/master 7a5e2690c -> f24ad7978 Fixing behavior with subresources and newer Swagger UI Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d345b60a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d345b60a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d345b60a Branch: refs/heads/3.1.x-fixes Commit: d345b60a487dd14aaf5d89542a3574f795d885df Parents: 0947c0a Author: Francesco ChicchiriccòAuthored: Fri Sep 23 13:38:59 2016 +0200 Committer: Francesco Chicchiriccò Committed: Fri Sep 23 13:38:59 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/d345b60a/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 ec52215..194a49e 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 @@ -106,8 +106,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw ClassResourceInfo cri = operations.get(entry.getKey()); tag = new Tag(); -String tagName = StringUtils.removeStart(cri.getURITemplate().getValue(), "/"); -tag.setName(StringUtils.isEmpty(tagName) ? "_" : tagName); + tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri)); }
[2/3] cxf git commit: Fixing behavior with subresources and newer Swagger UI
Fixing behavior with subresources and newer Swagger UI Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f24ad797 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f24ad797 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f24ad797 Branch: refs/heads/master Commit: f24ad79787ec011771b5ad40277e64e202895797 Parents: 7a5e269 Author: Francesco ChicchiriccòAuthored: Fri Sep 23 13:38:59 2016 +0200 Committer: Francesco Chicchiriccò Committed: Fri Sep 23 13:39:18 2016 +0200 -- .../org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/f24ad797/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 ec52215..194a49e 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 @@ -106,8 +106,7 @@ public class DefaultSwagger2Serializers extends SwaggerSerializers implements Sw ClassResourceInfo cri = operations.get(entry.getKey()); tag = new Tag(); -String tagName = StringUtils.removeStart(cri.getURITemplate().getValue(), "/"); -tag.setName(StringUtils.isEmpty(tagName) ? "_" : tagName); + tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri)); }
cxf git commit: [CXF-7022] Feature implemented [Forced Update!]
Repository: cxf Updated Branches: refs/heads/master 4ddbf53b1 -> c0ca26c64 (forced update) [CXF-7022] Feature implemented Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c0ca26c6 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c0ca26c6 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c0ca26c6 Branch: refs/heads/master Commit: c0ca26c64e83d6dc29b1438900b77e5345ef70e5 Parents: 27a511a Author: Francesco ChicchiriccòAuthored: Wed Aug 24 14:33:51 2016 +0200 Committer: Francesco Chicchiriccò Committed: Wed Aug 24 15:00:15 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 197 +++ .../cxf/jaxrs/swagger/Swagger2Feature.java | 59 +++--- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 148 +- 3 files changed, 232 insertions(+), 172 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/c0ca26c6/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 new file mode 100644 index 000..d6f0bb7 --- /dev/null +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -0,0 +1,197 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.models.HttpMethod; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.Tag; + +public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers { + +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + +protected List cris; + +@Override +public void writeTo( +final Swagger data, +final Class type, +final Type genericType, +final Annotation[] annotations, +final MediaType mediaType, +final MultivaluedMap headers, +final OutputStream out) throws IOException { + +if (dynamicBasePath) { +MessageContext ctx = JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + data.setBasePath(StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/")); +} + +if (replaceTags || javadocProvider != null) { +Map operations = new HashMap<>(); +Map , OperationResourceInfo> methods = new HashMap<>(); +for (ClassResourceInfo cri : cris) { +for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { +String normalizedPath =
cxf git commit: [CXF-7022] Feature implemented
Repository: cxf Updated Branches: refs/heads/CXF_7022 [created] 786703069 [CXF-7022] Feature implemented Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/78670306 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/78670306 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/78670306 Branch: refs/heads/CXF_7022 Commit: 78670306971faef844d06dd1715482a848bcccf4 Parents: 635aa32 Author: Francesco ChicchiriccòAuthored: Wed Aug 24 14:33:51 2016 +0200 Committer: Francesco Chicchiriccò Committed: Wed Aug 24 14:33:51 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 197 +++ .../cxf/jaxrs/swagger/Swagger2Feature.java | 59 +++--- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 148 +- 3 files changed, 232 insertions(+), 172 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/78670306/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 new file mode 100644 index 000..d6f0bb7 --- /dev/null +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -0,0 +1,197 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.models.HttpMethod; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.Tag; + +public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers { + +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + +protected List cris; + +@Override +public void writeTo( +final Swagger data, +final Class type, +final Type genericType, +final Annotation[] annotations, +final MediaType mediaType, +final MultivaluedMap headers, +final OutputStream out) throws IOException { + +if (dynamicBasePath) { +MessageContext ctx = JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + data.setBasePath(StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/")); +} + +if (replaceTags || javadocProvider != null) { +Map operations = new HashMap<>(); +Map , OperationResourceInfo> methods = new HashMap<>(); +for (ClassResourceInfo cri : cris) { +for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { +String normalizedPath = getNormalizedPath( +
cxf git commit: [CXF-7022] Feature implemented
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 327bb1fda -> 0c01db46c [CXF-7022] Feature implemented Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0c01db46 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0c01db46 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0c01db46 Branch: refs/heads/3.1.x-fixes Commit: 0c01db46c1834d0f7f837c7e71b30315042bfb08 Parents: 327bb1f Author: Francesco ChicchiriccòAuthored: Wed Aug 24 14:33:51 2016 +0200 Committer: Francesco Chicchiriccò Committed: Wed Aug 24 14:58:04 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 197 +++ .../cxf/jaxrs/swagger/Swagger2Feature.java | 59 +++--- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 148 +- 3 files changed, 232 insertions(+), 172 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/0c01db46/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 new file mode 100644 index 000..d6f0bb7 --- /dev/null +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -0,0 +1,197 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.models.HttpMethod; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.Tag; + +public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers { + +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + +protected List cris; + +@Override +public void writeTo( +final Swagger data, +final Class type, +final Type genericType, +final Annotation[] annotations, +final MediaType mediaType, +final MultivaluedMap headers, +final OutputStream out) throws IOException { + +if (dynamicBasePath) { +MessageContext ctx = JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + data.setBasePath(StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/")); +} + +if (replaceTags || javadocProvider != null) { +Map operations = new HashMap<>(); +Map , OperationResourceInfo> methods = new HashMap<>(); +for (ClassResourceInfo cri : cris) { +for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { +String normalizedPath = getNormalizedPath( +
[1/2] cxf git commit: Feature implemented
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 877b5a7a4 -> f9e4a4cad refs/heads/master 27a511a9c -> 4ddbf53b1 Feature implemented Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4ddbf53b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4ddbf53b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4ddbf53b Branch: refs/heads/master Commit: 4ddbf53b105a0a4155f4589f254cdef25065704d Parents: 27a511a Author: Francesco ChicchiriccòAuthored: Wed Aug 24 14:33:51 2016 +0200 Committer: Francesco Chicchiriccò Committed: Wed Aug 24 14:42:09 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 197 +++ .../cxf/jaxrs/swagger/Swagger2Feature.java | 59 +++--- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 148 +- 3 files changed, 232 insertions(+), 172 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/4ddbf53b/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 new file mode 100644 index 000..d6f0bb7 --- /dev/null +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -0,0 +1,197 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.models.HttpMethod; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.Tag; + +public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers { + +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + +protected List cris; + +@Override +public void writeTo( +final Swagger data, +final Class type, +final Type genericType, +final Annotation[] annotations, +final MediaType mediaType, +final MultivaluedMap headers, +final OutputStream out) throws IOException { + +if (dynamicBasePath) { +MessageContext ctx = JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + data.setBasePath(StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/")); +} + +if (replaceTags || javadocProvider != null) { +Map operations = new HashMap<>(); +Map , OperationResourceInfo> methods = new HashMap<>(); +for (ClassResourceInfo cri : cris) { +for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { +String
[2/2] cxf git commit: [CXF-7022] Feature implemented
[CXF-7022] Feature implemented Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f9e4a4ca Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f9e4a4ca Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f9e4a4ca Branch: refs/heads/3.0.x-fixes Commit: f9e4a4cad67a8f6e901306d45b307fea11ba1683 Parents: 877b5a7 Author: Francesco ChicchiriccòAuthored: Wed Aug 24 14:57:34 2016 +0200 Committer: Francesco Chicchiriccò Committed: Wed Aug 24 14:57:34 2016 +0200 -- .../swagger/DefaultSwagger2Serializers.java | 198 +++ .../cxf/jaxrs/swagger/Swagger2Feature.java | 47 ++--- .../cxf/jaxrs/swagger/Swagger2Serializers.java | 151 ++ 3 files changed, 224 insertions(+), 172 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/f9e4a4ca/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java -- diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java new file mode 100644 index 000..064d5b6 --- /dev/null +++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/DefaultSwagger2Serializers.java @@ -0,0 +1,198 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.swagger; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.jaxrs.model.doc.DocumentationProvider; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.models.HttpMethod; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.Tag; + +public class DefaultSwagger2Serializers extends SwaggerSerializers implements Swagger2Serializers { + +protected boolean dynamicBasePath; + +protected boolean replaceTags; + +protected DocumentationProvider javadocProvider; + +protected List cris; + +@Override +public void writeTo( +final Swagger data, +final Class type, +final Type genericType, +final Annotation[] annotations, +final MediaType mediaType, +final MultivaluedMap headers, +final OutputStream out) throws IOException { + +if (dynamicBasePath) { +MessageContext ctx = JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + data.setBasePath(StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/")); +} + +if (replaceTags || javadocProvider != null) { +Map operations = new HashMap (); +Map , OperationResourceInfo> methods = +new HashMap , OperationResourceInfo>(); +for (ClassResourceInfo cri : cris) { +for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { +String normalizedPath = getNormalizedPath( +
[cxf] Git Push Summary
Repository: cxf Updated Branches: refs/heads/CXF_7022 [deleted] 786703069
[3/3] cxf git commit: Minor changes to allow extending FiqlParser
Minor changes to allow extending FiqlParser Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5156dd25 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5156dd25 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5156dd25 Branch: refs/heads/3.1.x-fixes Commit: 5156dd256f8f59d22ea2d1ca50197f1b5b3f1788 Parents: 7e57ca6 Author: Francesco ChicchiriccòAuthored: Tue Nov 22 11:28:27 2016 +0100 Committer: Francesco Chicchiriccò Committed: Tue Nov 22 11:43:26 2016 +0100 -- .../jaxrs/ext/search/SimpleSearchCondition.java | 46 --- .../cxf/jaxrs/ext/search/fiql/FiqlParser.java | 60 +++- 2 files changed, 59 insertions(+), 47 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/5156dd25/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java -- diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java index c2e79de..96bc33e 100644 --- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java +++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java @@ -22,8 +22,8 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -41,16 +41,16 @@ import org.apache.cxf.jaxrs.ext.search.collections.CollectionCheckInfo; */ public class SimpleSearchCondition implements SearchCondition { -private static Set supportedTypes = new HashSet(); +protected static final Set SUPPORTED_TYPES = EnumSet.noneOf(ConditionType.class); static { -supportedTypes.add(ConditionType.EQUALS); -supportedTypes.add(ConditionType.NOT_EQUALS); -supportedTypes.add(ConditionType.GREATER_THAN); -supportedTypes.add(ConditionType.GREATER_OR_EQUALS); -supportedTypes.add(ConditionType.LESS_THAN); -supportedTypes.add(ConditionType.LESS_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.EQUALS); +SUPPORTED_TYPES.add(ConditionType.NOT_EQUALS); +SUPPORTED_TYPES.add(ConditionType.GREATER_THAN); +SUPPORTED_TYPES.add(ConditionType.GREATER_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.LESS_THAN); +SUPPORTED_TYPES.add(ConditionType.LESS_OR_EQUALS); } -private ConditionType joiningType = ConditionType.AND; +private final ConditionType joiningType = ConditionType.AND; private T condition; private List scts; @@ -69,7 +69,7 @@ public class SimpleSearchCondition implements SearchCondition { if (condition == null) { throw new IllegalArgumentException("condition is null"); } -if (!supportedTypes.contains(cType)) { +if (!SUPPORTED_TYPES.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; @@ -83,6 +83,8 @@ public class SimpleSearchCondition implements SearchCondition { * per-getter comparison strategy. * * @param getters2operators getters names and operators to be used with them during comparison + * @param realGetters + * @param propertyTypeInfo * @param condition template object */ public SimpleSearchCondition(Map getters2operators, @@ -102,7 +104,7 @@ public class SimpleSearchCondition implements SearchCondition { } this.condition = condition; for (ConditionType ct : getters2operators.values()) { -if (!supportedTypes.contains(ct)) { +if (!SUPPORTED_TYPES.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name()); } } @@ -114,6 +116,7 @@ public class SimpleSearchCondition implements SearchCondition { this(getters2operators, null, null, condition); } +@Override public T getCondition() { return condition; } @@ -123,6 +126,7 @@ public class SimpleSearchCondition implements SearchCondition { * * When constructor with map is used it returns null. */ +@Override public ConditionType getConditionType() { if (scts.size() > 1) { return joiningType; @@ -131,6 +135,7 @@ public class SimpleSearchCondition implements SearchCondition
[2/3] cxf git commit: Minor changes to allow extending FiqlParser
Minor changes to allow extending FiqlParser Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9d4fb9a8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9d4fb9a8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9d4fb9a8 Branch: refs/heads/3.0.x-fixes Commit: 9d4fb9a8aefddb7d6ba6c4520e7049c2c13bc6e6 Parents: 569678e Author: Francesco ChicchiriccòAuthored: Tue Nov 22 11:28:27 2016 +0100 Committer: Francesco Chicchiriccò Committed: Tue Nov 22 11:43:16 2016 +0100 -- .../jaxrs/ext/search/SimpleSearchCondition.java | 32 ++-- .../cxf/jaxrs/ext/search/fiql/FiqlParser.java | 40 +++- 2 files changed, 42 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/9d4fb9a8/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java -- diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java index c2e79de..b76beb4 100644 --- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java +++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java @@ -22,8 +22,8 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -41,16 +41,16 @@ import org.apache.cxf.jaxrs.ext.search.collections.CollectionCheckInfo; */ public class SimpleSearchCondition implements SearchCondition { -private static Set supportedTypes = new HashSet(); +protected static final Set SUPPORTED_TYPES = EnumSet.noneOf(ConditionType.class); static { -supportedTypes.add(ConditionType.EQUALS); -supportedTypes.add(ConditionType.NOT_EQUALS); -supportedTypes.add(ConditionType.GREATER_THAN); -supportedTypes.add(ConditionType.GREATER_OR_EQUALS); -supportedTypes.add(ConditionType.LESS_THAN); -supportedTypes.add(ConditionType.LESS_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.EQUALS); +SUPPORTED_TYPES.add(ConditionType.NOT_EQUALS); +SUPPORTED_TYPES.add(ConditionType.GREATER_THAN); +SUPPORTED_TYPES.add(ConditionType.GREATER_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.LESS_THAN); +SUPPORTED_TYPES.add(ConditionType.LESS_OR_EQUALS); } -private ConditionType joiningType = ConditionType.AND; +private final ConditionType joiningType = ConditionType.AND; private T condition; private List scts; @@ -69,7 +69,7 @@ public class SimpleSearchCondition implements SearchCondition { if (condition == null) { throw new IllegalArgumentException("condition is null"); } -if (!supportedTypes.contains(cType)) { +if (!SUPPORTED_TYPES.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; @@ -83,6 +83,8 @@ public class SimpleSearchCondition implements SearchCondition { * per-getter comparison strategy. * * @param getters2operators getters names and operators to be used with them during comparison + * @param realGetters + * @param propertyTypeInfo * @param condition template object */ public SimpleSearchCondition(Map getters2operators, @@ -102,7 +104,7 @@ public class SimpleSearchCondition implements SearchCondition { } this.condition = condition; for (ConditionType ct : getters2operators.values()) { -if (!supportedTypes.contains(ct)) { +if (!SUPPORTED_TYPES.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name()); } } @@ -114,6 +116,7 @@ public class SimpleSearchCondition implements SearchCondition { this(getters2operators, null, null, condition); } +@Override public T getCondition() { return condition; } @@ -123,6 +126,7 @@ public class SimpleSearchCondition implements SearchCondition { * * When constructor with map is used it returns null. */ +@Override public ConditionType getConditionType() { if (scts.size() > 1) { return joiningType; @@ -131,6 +135,7 @@ public class SimpleSearchCondition implements SearchCondition
[1/3] cxf git commit: Minor changes to allow extending FiqlParser
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 569678ec8 -> 9d4fb9a8a refs/heads/3.1.x-fixes 7e57ca653 -> 5156dd256 refs/heads/master e47a79f94 -> 301248b26 Minor changes to allow extending FiqlParser Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/301248b2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/301248b2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/301248b2 Branch: refs/heads/master Commit: 301248b264c6a7ddef5c367bd4fdf55fbeee24a9 Parents: e47a79f Author: Francesco ChicchiriccòAuthored: Tue Nov 22 11:28:27 2016 +0100 Committer: Francesco Chicchiriccò Committed: Tue Nov 22 11:28:54 2016 +0100 -- .../jaxrs/ext/search/SimpleSearchCondition.java | 46 --- .../cxf/jaxrs/ext/search/fiql/FiqlParser.java | 60 +++- 2 files changed, 59 insertions(+), 47 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/301248b2/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java -- diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java index c2e79de..96bc33e 100644 --- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java +++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java @@ -22,8 +22,8 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -41,16 +41,16 @@ import org.apache.cxf.jaxrs.ext.search.collections.CollectionCheckInfo; */ public class SimpleSearchCondition implements SearchCondition { -private static Set supportedTypes = new HashSet(); +protected static final Set SUPPORTED_TYPES = EnumSet.noneOf(ConditionType.class); static { -supportedTypes.add(ConditionType.EQUALS); -supportedTypes.add(ConditionType.NOT_EQUALS); -supportedTypes.add(ConditionType.GREATER_THAN); -supportedTypes.add(ConditionType.GREATER_OR_EQUALS); -supportedTypes.add(ConditionType.LESS_THAN); -supportedTypes.add(ConditionType.LESS_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.EQUALS); +SUPPORTED_TYPES.add(ConditionType.NOT_EQUALS); +SUPPORTED_TYPES.add(ConditionType.GREATER_THAN); +SUPPORTED_TYPES.add(ConditionType.GREATER_OR_EQUALS); +SUPPORTED_TYPES.add(ConditionType.LESS_THAN); +SUPPORTED_TYPES.add(ConditionType.LESS_OR_EQUALS); } -private ConditionType joiningType = ConditionType.AND; +private final ConditionType joiningType = ConditionType.AND; private T condition; private List scts; @@ -69,7 +69,7 @@ public class SimpleSearchCondition implements SearchCondition { if (condition == null) { throw new IllegalArgumentException("condition is null"); } -if (!supportedTypes.contains(cType)) { +if (!SUPPORTED_TYPES.contains(cType)) { throw new IllegalArgumentException("unsupported condition type: " + cType.name()); } this.condition = condition; @@ -83,6 +83,8 @@ public class SimpleSearchCondition implements SearchCondition { * per-getter comparison strategy. * * @param getters2operators getters names and operators to be used with them during comparison + * @param realGetters + * @param propertyTypeInfo * @param condition template object */ public SimpleSearchCondition(Map getters2operators, @@ -102,7 +104,7 @@ public class SimpleSearchCondition implements SearchCondition { } this.condition = condition; for (ConditionType ct : getters2operators.values()) { -if (!supportedTypes.contains(ct)) { +if (!SUPPORTED_TYPES.contains(ct)) { throw new IllegalArgumentException("unsupported condition type: " + ct.name()); } } @@ -114,6 +116,7 @@ public class SimpleSearchCondition implements SearchCondition { this(getters2operators, null, null, condition); } +@Override public T getCondition() { return condition; } @@ -123,6 +126,7 @@ public class SimpleSearchCondition implements SearchCondition { * * When constructor with map is used it returns null. */ +@Override public ConditionType
[2/2] cxf git commit: Upgrading swagger-core to 1.5.12
Upgrading swagger-core to 1.5.12 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/04720d55 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/04720d55 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/04720d55 Branch: refs/heads/master Commit: 04720d55a297aa4778a8194a766d9159ba662d33 Parents: aa5cb3f Author: Francesco ChicchiriccòAuthored: Thu Dec 29 15:27:38 2016 +0100 Committer: Francesco Chicchiriccò Committed: Thu Dec 29 15:27:52 2016 +0100 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/04720d55/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 85f8338..8b3bfe9 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -150,7 +150,7 @@ 2.2.0.RELEASE spring-test 1.3.13 -1.5.11 +1.5.12 1.7 5.0.3 3.1.4
[1/2] cxf git commit: Upgrading swagger-core to 1.5.12
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 4295775d2 -> feaececcc refs/heads/master aa5cb3f48 -> 04720d55a Upgrading swagger-core to 1.5.12 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/feaececc Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/feaececc Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/feaececc Branch: refs/heads/3.1.x-fixes Commit: feaececcc19cf13b42d2c20d8f8a6e5c465cda93 Parents: 4295775 Author: Francesco ChicchiriccòAuthored: Thu Dec 29 15:27:38 2016 +0100 Committer: Francesco Chicchiriccò Committed: Thu Dec 29 15:27:38 2016 +0100 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/feaececc/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 980ec15..e39c7e5 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -151,7 +151,7 @@ 2.2.0.RELEASE spring-test 1.3.13 -1.5.11 +1.5.12 1.7 4.4.1 3.1.4
[1/2] cxf git commit: Make Swagger2 sample work again
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 47d32e633 -> 11e1a869c refs/heads/master 939a75d9d -> 11637433d Make Swagger2 sample work again Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/11e1a869 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/11e1a869 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/11e1a869 Branch: refs/heads/3.1.x-fixes Commit: 11e1a869c20da768d15ea16b1651f29a897f09df Parents: 47d32e6 Author: Francesco ChicchiriccòAuthored: Wed Dec 28 09:00:15 2016 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 28 09:00:15 2016 +0100 -- .../main/release/samples/jax_rs/description_swagger2/pom.xml| 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/11e1a869/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml -- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml index 9a9ab91..18ac55f 100644 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml @@ -82,6 +82,11 @@ 3.1.10-SNAPSHOT + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.6.6 + + org.eclipse.jetty jetty-webapp
[2/2] cxf git commit: Make Swagger2 sample work again
Make Swagger2 sample work again Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/11637433 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/11637433 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/11637433 Branch: refs/heads/master Commit: 11637433df089a638e173d1ef57441e7456cf2ea Parents: 939a75d Author: Francesco ChicchiriccòAuthored: Wed Dec 28 09:00:15 2016 +0100 Committer: Francesco Chicchiriccò Committed: Wed Dec 28 09:00:30 2016 +0100 -- .../main/release/samples/jax_rs/description_swagger2/pom.xml| 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/11637433/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml -- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml index 5d203ac..040f2e3 100644 --- a/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml +++ b/distribution/src/main/release/samples/jax_rs/description_swagger2/pom.xml @@ -82,6 +82,11 @@ 3.2.0-SNAPSHOT + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.6.6 + + org.eclipse.jetty jetty-webapp
[1/2] cxf git commit: Upgrading to Swagger JAX-RS 1.5.11
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 2ac0b9a91 -> 47d32e633 refs/heads/master c194254d6 -> 939a75d9d Upgrading to Swagger JAX-RS 1.5.11 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/47d32e63 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/47d32e63 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/47d32e63 Branch: refs/heads/3.1.x-fixes Commit: 47d32e6333429a4809f5dedc7d39b4d884b21f28 Parents: 2ac0b9a Author: Francesco ChicchiriccòAuthored: Tue Dec 27 12:12:58 2016 +0100 Committer: Francesco Chicchiriccò Committed: Tue Dec 27 12:12:58 2016 +0100 -- parent/pom.xml | 2 +- .../org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java | 13 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/47d32e63/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index c26f12c..980ec15 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -151,7 +151,7 @@ 2.2.0.RELEASE spring-test 1.3.13 -1.5.10 +1.5.11 1.7 4.4.1 3.1.4 http://git-wip-us.apache.org/repos/asf/cxf/blob/47d32e63/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index 87e0cf2..57437c5 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -20,6 +20,7 @@ package org.apache.cxf.jaxrs.swagger; import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -184,17 +185,17 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(Min.class.getName())) { Min min = (Min) annos.get(Min.class.getName()); -serializable.setMinimum(new Double(min.value())); +serializable.setMinimum(BigDecimal.valueOf(min.value())); } if (annos.containsKey(Max.class.getName())) { Max max = (Max) annos.get(Max.class.getName()); -serializable.setMaximum(new Double(max.value())); +serializable.setMaximum(BigDecimal.valueOf(max.value())); } if (annos.containsKey(Size.class.getName())) { Size size = (Size) annos.get(Size.class.getName()); -serializable.setMinimum(new Double(size.min())); -serializable.setMaximum(new Double(size.max())); +serializable.setMinimum(BigDecimal.valueOf(size.min())); +serializable.setMaximum(BigDecimal.valueOf(size.max())); serializable.setMinItems(size.min()); serializable.setMaxItems(size.max()); @@ -202,7 +203,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(DecimalMin.class.getName())) { DecimalMin min = (DecimalMin) annos.get(DecimalMin.class.getName()); if (min.inclusive()) { -serializable.setMinimum(new Double(min.value())); +serializable.setMinimum(BigDecimal.valueOf(new Double(min.value(; } else { serializable.setExclusiveMinimum(!min.inclusive()); } @@ -210,7 +211,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(DecimalMax.class.getName())) { DecimalMax max = (DecimalMax) annos.get(DecimalMax.class.getName()); if (max.inclusive()) { -serializable.setMaximum(new Double(max.value())); +serializable.setMaximum(BigDecimal.valueOf(new Double(max.value(; } else { serializable.setExclusiveMaximum(!max.inclusive()); }
[2/2] cxf git commit: Upgrading to Swagger JAX-RS 1.5.11
Upgrading to Swagger JAX-RS 1.5.11 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/939a75d9 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/939a75d9 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/939a75d9 Branch: refs/heads/master Commit: 939a75d9d3dbfbe37ead5ca41e5e53727dc40b40 Parents: c194254 Author: Francesco ChicchiriccòAuthored: Tue Dec 27 12:12:58 2016 +0100 Committer: Francesco Chicchiriccò Committed: Tue Dec 27 12:13:11 2016 +0100 -- parent/pom.xml | 2 +- .../org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java | 13 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/939a75d9/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 038a076..4633e39 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -151,7 +151,7 @@ 2.2.0.RELEASE spring-test 1.3.13 -1.5.10 +1.5.11 1.7 5.0.3 3.1.4 http://git-wip-us.apache.org/repos/asf/cxf/blob/939a75d9/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java -- diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java index 87e0cf2..57437c5 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/JaxRs2Extension.java @@ -20,6 +20,7 @@ package org.apache.cxf.jaxrs.swagger; import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -184,17 +185,17 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(Min.class.getName())) { Min min = (Min) annos.get(Min.class.getName()); -serializable.setMinimum(new Double(min.value())); +serializable.setMinimum(BigDecimal.valueOf(min.value())); } if (annos.containsKey(Max.class.getName())) { Max max = (Max) annos.get(Max.class.getName()); -serializable.setMaximum(new Double(max.value())); +serializable.setMaximum(BigDecimal.valueOf(max.value())); } if (annos.containsKey(Size.class.getName())) { Size size = (Size) annos.get(Size.class.getName()); -serializable.setMinimum(new Double(size.min())); -serializable.setMaximum(new Double(size.max())); +serializable.setMinimum(BigDecimal.valueOf(size.min())); +serializable.setMaximum(BigDecimal.valueOf(size.max())); serializable.setMinItems(size.min()); serializable.setMaxItems(size.max()); @@ -202,7 +203,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(DecimalMin.class.getName())) { DecimalMin min = (DecimalMin) annos.get(DecimalMin.class.getName()); if (min.inclusive()) { -serializable.setMinimum(new Double(min.value())); +serializable.setMinimum(BigDecimal.valueOf(new Double(min.value(; } else { serializable.setExclusiveMinimum(!min.inclusive()); } @@ -210,7 +211,7 @@ public class JaxRs2Extension extends AbstractSwaggerExtension { if (annos.containsKey(DecimalMax.class.getName())) { DecimalMax max = (DecimalMax) annos.get(DecimalMax.class.getName()); if (max.inclusive()) { -serializable.setMaximum(new Double(max.value())); +serializable.setMaximum(BigDecimal.valueOf(new Double(max.value(; } else { serializable.setExclusiveMaximum(!max.inclusive()); }
cxf git commit: [CXF-7316] Avoid NPE when not using swagger2Serializers (swagger-jaxrs 1.5.13)
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes df56ca9fa -> b510792d6 [CXF-7316] Avoid NPE when not using swagger2Serializers (swagger-jaxrs 1.5.13) Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b510792d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b510792d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b510792d Branch: refs/heads/3.1.x-fixes Commit: b510792d63c135c2392bd10ac68f1bee7f21edb0 Parents: df56ca9 Author: Francesco ChicchiriccòAuthored: Fri May 12 08:20:43 2017 +0200 Committer: Francesco Chicchiriccò Committed: Fri May 12 08:20:43 2017 +0200 -- .../main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java| 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/b510792d/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java -- diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java index d5813b0..350e28f 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java @@ -209,8 +209,6 @@ public class Swagger2Feature extends AbstractSwaggerFeature { swagger.setSecurityDefinitions(securityDefinitions); } -swagger2Serializers.setBeanConfig(beanConfig); - if (customizer == null) { swagger2Serializers.setBeanConfig(beanConfig); } else {
[cxf] branch master updated: Take default signAlgo from JWS headers (fixes compatibility issue with Azure)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 144a32e Take default signAlgo from JWS headers (fixes compatibility issue with Azure) 144a32e is described below commit 144a32e669e4fe242f52cd9626e899e7f4f65820 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue May 8 10:54:47 2018 +0200 Take default signAlgo from JWS headers (fixes compatibility issue with Azure) --- .../java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java index 52dd672..222d421 100644 --- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java +++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java @@ -153,7 +153,7 @@ public class OidcClaimsValidator extends OAuthJoseJwtConsumer { } JwsSignatureVerifier theJwsVerifier = null; if (key != null) { -theJwsVerifier = JwsUtils.getSignatureVerifier(key); +theJwsVerifier = JwsUtils.getSignatureVerifier(key, jwt.getJwsHeaders().getSignatureAlgorithm()); } else { theJwsVerifier = super.getInitializedSignatureVerifier(jwt.getJwsHeaders()); } -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch 3.1.x-fixes updated (73486d7 -> 78f2233)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git. from 73486d7 [CXF-7736]:DispatchImpl doesn't work for an empty Source add 78f2233 Take default signAlgo from JWS headers (fixes compatibility issue with Azure) No new revisions were added by this update. Summary of changes: .../java/org/apache/cxf/rs/security/oidc/rp/OidcClaimsValidator.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf-fediz] branch 1.4.x-fixes updated: Ensure relayState is url-encoded as well
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 1.4.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git The following commit(s) were added to refs/heads/1.4.x-fixes by this push: new 159a36b Ensure relayState is url-encoded as well 159a36b is described below commit 159a36bd6423cbae18f360bd171dbbdbb20ab690 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue May 8 15:08:35 2018 +0200 Ensure relayState is url-encoded as well --- .../cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java| 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java index 75dfe4e..a299499 100644 --- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java +++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java @@ -292,9 +292,10 @@ public class AuthnRequestParser { sig.initVerify(validatingCert); // Recreate request to sign -String requestToSign = SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(samlRequest, "UTF-8") -+ "&" + SSOConstants.RELAY_STATE + "=" + relayState + "&" + SSOConstants.SIG_ALG -+ "=" + URLEncoder.encode(processedSigAlg, StandardCharsets.UTF_8.name()); +String requestToSign = +SSOConstants.SAML_REQUEST + "=" + URLEncoder.encode(samlRequest, StandardCharsets.UTF_8.name()) ++ "&" + SSOConstants.RELAY_STATE + "=" + URLEncoder.encode(relayState, StandardCharsets.UTF_8.name()) ++ "&" + SSOConstants.SIG_ALG + "=" + URLEncoder.encode(processedSigAlg, StandardCharsets.UTF_8.name()); sig.update(requestToSign.getBytes(StandardCharsets.UTF_8)); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: [CXF-7525] Fixing enum support
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 9c29ffa [CXF-7525] Fixing enum support 9c29ffa is described below commit 9c29ffae95a989572c56ac2d595e89b4a8e7c35f Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Fri Jan 5 11:36:16 2018 +0100 [CXF-7525] Fixing enum support --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java| 4 1 file changed, 4 insertions(+) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 8d172d2..5f82bcc 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -260,9 +260,13 @@ public final class SwaggerToOpenApiConversionUtils { sw2PathVerbParamMap.setProperty("schema", schema); } else { String type = (String)sw2PathVerbParamMap.removeProperty("type"); +Object enumK = sw2PathVerbParamMap.removeProperty("enum"); if (type != null) { JsonMapObject schema = new JsonMapObject(); schema.setProperty("type", type); +if (enumK != null) { +schema.setProperty("enum", enumK); +} for (String prop : SIMPLE_TYPE_RELATED_PROPS) { Object value = sw2PathVerbParamMap.removeProperty(prop); if (value != null) { -- To stop receiving notification emails like this one, please contact ['"commits@cxf.apache.org" <commits@cxf.apache.org>'].
[cxf] branch 3.1.x-fixes updated: [CXF-7525] Fixing enum support
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new a5d873b [CXF-7525] Fixing enum support a5d873b is described below commit a5d873b97dc15ce3bb5a6fcd1f9efa50e7f25901 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Fri Jan 5 11:36:16 2018 +0100 [CXF-7525] Fixing enum support --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 63e3274..e3ebb39 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -244,7 +244,7 @@ public final class SwaggerToOpenApiConversionUtils { } else if ("formData".equals(sw2PathVerbParamMap.getStringProperty("in"))) { it.remove(); if (sw3formBody == null) { -sw3formBody = new LinkedList(); +sw3formBody = new LinkedList<>(); sw3RequestBody = new JsonMapObject(); } sw2PathVerbParamMap.removeProperty("in"); @@ -262,9 +262,13 @@ public final class SwaggerToOpenApiConversionUtils { sw2PathVerbParamMap.setProperty("schema", schema); } else { String type = (String)sw2PathVerbParamMap.removeProperty("type"); +Object enumK = sw2PathVerbParamMap.removeProperty("enum"); if (type != null) { JsonMapObject schema = new JsonMapObject(); schema.setProperty("type", type); +if (enumK != null) { +schema.setProperty("enum", enumK); +} for (String prop : SIMPLE_TYPE_RELATED_PROPS) { Object value = sw2PathVerbParamMap.removeProperty(prop); if (value != null) { -- To stop receiving notification emails like this one, please contact ['"commits@cxf.apache.org" <commits@cxf.apache.org>'].
[cxf] branch master updated: [CXF-7525] Fixing enum support
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 5954acb [CXF-7525] Fixing enum support 5954acb is described below commit 5954acb299b27b72c3231d129a79ecc812de0a23 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Mon Jan 8 11:50:43 2018 +0100 [CXF-7525] Fixing enum support --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 6 ++ 1 file changed, 6 insertions(+) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 5f82bcc..6e1d9d1 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -259,6 +259,12 @@ public final class SwaggerToOpenApiConversionUtils { schema.setProperty("items", items); sw2PathVerbParamMap.setProperty("schema", schema); } else { +if ("matrix".equals(sw2PathVerbParamMap.getStringProperty("in"))) { +sw2PathVerbParamMap.removeProperty("in"); +sw2PathVerbParamMap.setProperty("in", "path"); +sw2PathVerbParamMap.setProperty("style", "matrix"); +} + String type = (String)sw2PathVerbParamMap.removeProperty("type"); Object enumK = sw2PathVerbParamMap.removeProperty("enum"); if (type != null) { -- To stop receiving notification emails like this one, please contact ['"commits@cxf.apache.org" <commits@cxf.apache.org>'].
[cxf] branch 3.1.x-fixes updated: [CXF-7525] Fixing enum support
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new 7e2945e [CXF-7525] Fixing enum support 7e2945e is described below commit 7e2945ecf552075cb52460e9eb62da7f673a4f49 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Mon Jan 8 11:50:43 2018 +0100 [CXF-7525] Fixing enum support --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 6 ++ 1 file changed, 6 insertions(+) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index e3ebb39..ee45fbb 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -261,6 +261,12 @@ public final class SwaggerToOpenApiConversionUtils { schema.setProperty("items", items); sw2PathVerbParamMap.setProperty("schema", schema); } else { +if ("matrix".equals(sw2PathVerbParamMap.getStringProperty("in"))) { +sw2PathVerbParamMap.removeProperty("in"); +sw2PathVerbParamMap.setProperty("in", "path"); +sw2PathVerbParamMap.setProperty("style", "matrix"); +} + String type = (String)sw2PathVerbParamMap.removeProperty("type"); Object enumK = sw2PathVerbParamMap.removeProperty("enum"); if (type != null) { -- To stop receiving notification emails like this one, please contact ['"commits@cxf.apache.org" <commits@cxf.apache.org>'].
[cxf] branch 3.1.x-fixes updated: [CXF-7525] Fixing Basic Authentication translation
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new ffee295 [CXF-7525] Fixing Basic Authentication translation ffee295 is described below commit ffee29551ea7f1f2f511ece45eca4463b1d94b8f Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Fri Jan 26 13:07:18 2018 +0100 [CXF-7525] Fixing Basic Authentication translation --- .../jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index ee45fbb..67dafb7 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -143,9 +143,17 @@ public final class SwaggerToOpenApiConversionUtils { if (s2Defs != null) { comps.setProperty("schemas", s2Defs); } -Object s2SecurityDefs = sw2.getProperty("securityDefinitions"); +JsonMapObject s2SecurityDefs = sw2.getJsonMapProperty("securityDefinitions"); if (s2SecurityDefs != null) { comps.setProperty("securitySchemes", s2SecurityDefs); + +for (String property : s2SecurityDefs.asMap().keySet()) { +JsonMapObject securityScheme = s2SecurityDefs.getJsonMapProperty(property); +if ("basic".equals(securityScheme.getStringProperty("type"))) { +securityScheme.setProperty("type", "http"); +securityScheme.setProperty("scheme", "basic"); +} +} } sw3.setProperty("components", comps); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: [CXF-7525] Fixing Basic Authentication translation
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 4b8686f [CXF-7525] Fixing Basic Authentication translation 4b8686f is described below commit 4b8686f606e0748edaeacd26d528a2527d6479de Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Fri Jan 26 13:07:18 2018 +0100 [CXF-7525] Fixing Basic Authentication translation --- .../jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 6e1d9d1..66d2dd9 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -143,9 +143,17 @@ public final class SwaggerToOpenApiConversionUtils { if (s2Defs != null) { comps.setProperty("schemas", s2Defs); } -Object s2SecurityDefs = sw2.getProperty("securityDefinitions"); +JsonMapObject s2SecurityDefs = sw2.getJsonMapProperty("securityDefinitions"); if (s2SecurityDefs != null) { comps.setProperty("securitySchemes", s2SecurityDefs); + +for (String property : s2SecurityDefs.asMap().keySet()) { +JsonMapObject securityScheme = s2SecurityDefs.getJsonMapProperty(property); +if ("basic".equals(securityScheme.getStringProperty("type"))) { +securityScheme.setProperty("type", "http"); +securityScheme.setProperty("scheme", "basic"); +} +} } sw3.setProperty("components", comps); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: [CXF-7525] Upgrade Swagger v3 and Swagger UI + full migrate Swagger2Customizer to OpenApiCustomizer
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 1697c1f [CXF-7525] Upgrade Swagger v3 and Swagger UI + full migrate Swagger2Customizer to OpenApiCustomizer 1697c1f is described below commit 1697c1f1cd1467860083140601ffa6cd14d12eaf Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue Jan 30 14:36:16 2018 +0100 [CXF-7525] Upgrade Swagger v3 and Swagger UI + full migrate Swagger2Customizer to OpenApiCustomizer --- parent/pom.xml | 4 +- .../apache/cxf/jaxrs/openapi/JaxRs2Extension.java | 158 +++ .../jaxrs/openapi/OpenApiCustomizedResource.java | 35 +++-- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 167 +++-- .../apache/cxf/jaxrs/openapi/OpenApiFeature.java | 22 ++- .../io.swagger.v3.jaxrs2.ext.OpenAPIExtension | 1 + 6 files changed, 352 insertions(+), 35 deletions(-) diff --git a/parent/pom.xml b/parent/pom.xml index c5761f6..9745c34 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -160,8 +160,8 @@ 2.3.2.RELEASE spring-test 1.5.17 -2.0.0-rc3 -3.9.0 +2.0.0-rc4 +3.9.2 2.0 5.0.3 3.1.4 diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java new file mode 100644 index 000..aa345d9 --- /dev/null +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java @@ -0,0 +1,158 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxrs.openapi; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import javax.ws.rs.Consumes; +import javax.ws.rs.MatrixParam; + +import io.swagger.v3.core.converter.ModelConverters; +import io.swagger.v3.core.converter.ResolvedSchema; +import io.swagger.v3.jaxrs2.ResolvedParameter; +import io.swagger.v3.jaxrs2.ext.AbstractOpenAPIExtension; +import io.swagger.v3.jaxrs2.ext.OpenAPIExtension; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.parameters.PathParameter; + +/** + * Adds matrix parameters support. + */ +public class JaxRs2Extension extends AbstractOpenAPIExtension { + +@Override +public ResolvedParameter extractParameters( +final List annotations, +final Type type, +final Set typesToSkip, +final Components components, +final Consumes classConsumes, +final Consumes methodConsumes, +final boolean includeRequestBody, +final Iterator chain) { + +if (shouldIgnoreType(type, typesToSkip)) { +return new ResolvedParameter(); +} + +List parameters = annotations.stream(). +filter(annotation -> annotation instanceof MatrixParam). +map(annotation -> { +MatrixParam param = (MatrixParam) annotation; +Parameter mp = new PathParameter().name(param.value()); +mp.setStyle(Parameter.StyleEnum.MATRIX); + +ResolvedSchema resolvedSchema = ModelConverters.getInstance().readAllAsResolvedSchema(type); +if (resolvedSchema != null) { +mp
[cxf] branch master updated: [CXF-7525] Cleanup
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 8d1c408 [CXF-7525] Cleanup 8d1c408 is described below commit 8d1c408b6aba028be5f0f529a3eacb864b981e74 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue Jan 30 14:45:48 2018 +0100 [CXF-7525] Cleanup --- .../apache/cxf/jaxrs/openapi/OpenApiCustomizedResource.java | 11 --- 1 file changed, 11 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizedResource.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizedResource.java index ceb7f70..97931ae 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizedResource.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizedResource.java @@ -40,25 +40,16 @@ public class OpenApiCustomizedResource extends OpenApiResource { private final OpenApiCustomizer customizer; -//private boolean customized; - public OpenApiCustomizedResource(final OpenApiCustomizer customizer) { this.customizer = customizer; } -//private void setCustomized() { -//synchronized (customizer) { -//customized = true; -//} -//} - @GET @Produces({ MediaType.APPLICATION_JSON, "application/yaml" }) @Operation(hidden = true) public Response getOpenApi(@Context ServletConfig config, @Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type) throws Exception { -//if (customizer != null && !customized) { if (customizer != null) { final OpenAPIConfiguration configuration = customizer.customize(getOpenApiConfiguration()); setOpenApiConfiguration(configuration); @@ -73,8 +64,6 @@ public class OpenApiCustomizedResource extends OpenApiResource { ((GenericOpenApiContext) ctx).getOpenApiReader().setConfiguration(configuration); customizer.customize(ctx.read()); } - -//setCustomized(); } return super.getOpenApi(headers, uriInfo, type); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: [CXF-7525] Fix test, broken due to swagger-jaxrs2 upgrade to 2.0.0-rc4 - see https://github.com/swagger-api/swagger-core/issues/2643
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 60b98ee [CXF-7525] Fix test, broken due to swagger-jaxrs2 upgrade to 2.0.0-rc4 - see https://github.com/swagger-api/swagger-core/issues/2643 60b98ee is described below commit 60b98ee48fb0219b58be94b9bdbfcf1cb1e41d29 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Wed Jan 31 13:57:31 2018 +0100 [CXF-7525] Fix test, broken due to swagger-jaxrs2 upgrade to 2.0.0-rc4 - see https://github.com/swagger-api/swagger-core/issues/2643 --- .../org/apache/cxf/systest/jaxrs/description/group1/BookStore.java | 3 --- .../description/openapi/AbstractOpenApiServiceDescriptionTest.java | 6 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStore.java index 15b02f0..9151f8e 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStore.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStore.java @@ -35,9 +35,6 @@ import org.apache.cxf.systest.jaxrs.Book; import io.swagger.annotations.Api; -//FIXME swagger-jaxrs 1.5.3 can't handle a self-recursive sub resource like Book. so hide Book for now -//import org.apache.cxf.systest.jaxrs.Book; - @Path("/bookstore") @Api("/bookstore") public class BookStore { diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java index e4a845b..ee89fe0 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java @@ -156,14 +156,16 @@ public abstract class AbstractOpenApiServiceDescriptionTest extends AbstractBusC Map<String, UserOperation> map = r.getOperationsAsMap(); assertEquals(3, map.size()); -UserOperation getBooksOp = map.get("getBooks"); +// see https://github.com/swagger-api/swagger-core/issues/2643 +UserOperation getBooksOp = map.containsKey("getBooks") ? map.get("getBooks") : map.get("getBooks_1"); assertEquals(HttpMethod.GET, getBooksOp.getVerb()); assertEquals("/bookstore", getBooksOp.getPath()); assertEquals(MediaType.APPLICATION_JSON, getBooksOp.getProduces()); List getBooksOpParams = getBooksOp.getParameters(); assertEquals(1, getBooksOpParams.size()); assertEquals(ParameterType.QUERY, getBooksOpParams.get(0).getType()); -UserOperation getBookOp = map.get("getBook"); +// see https://github.com/swagger-api/swagger-core/issues/2643 +UserOperation getBookOp = map.containsKey("getBook") ? map.get("getBook") : map.get("getBook_1"); assertEquals(HttpMethod.GET, getBookOp.getVerb()); assertEquals("/bookstore/{id}", getBookOp.getPath()); assertEquals(MediaType.APPLICATION_JSON, getBookOp.getProduces()); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch 3.1.x-fixes updated: [CXF-7637] 'pattern' property was removed
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new 99ded5f [CXF-7637] 'pattern' property was removed 99ded5f is described below commit 99ded5f8a6f5fa00b64531542c7c0b5b0ab8b92c Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue Feb 13 18:59:03 2018 +0100 [CXF-7637] 'pattern' property was removed --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 67dafb7..611b9ac 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -228,6 +228,7 @@ public final class SwaggerToOpenApiConversionUtils { if (sw2PathVerbParamsList != null) { for (Iterator<Map<String, Object>> it = sw2PathVerbParamsList.iterator(); it.hasNext();) { JsonMapObject sw2PathVerbParamMap = new JsonMapObject(it.next()); +sw2PathVerbParamMap.removeProperty("pattern"); if ("body".equals(sw2PathVerbParamMap.getStringProperty("in"))) { it.remove(); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch 3.1.x-fixes updated: [CXF-7637] Support for 'discriminator'
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new 26fb2ed [CXF-7637] Support for 'discriminator' 26fb2ed is described below commit 26fb2ed79a78c46503330b2f115ef1b0f72a4974 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue Feb 13 22:25:27 2018 +0100 [CXF-7637] Support for 'discriminator' --- .../swagger/openapi/SwaggerToOpenApiConversionUtils.java | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 611b9ac..f5358b6 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -139,8 +139,20 @@ public final class SwaggerToOpenApiConversionUtils { } comps.setProperty("requestBodies", requestBodiesObj); -Object s2Defs = sw2.getProperty("definitions"); +JsonMapObject s2Defs = sw2.getJsonMapProperty("definitions"); if (s2Defs != null) { +for (Object schema : s2Defs.asMap().values()) { +if (schema instanceof Map) { +@SuppressWarnings("unchecked") +Map<String, Object> schemaMap = (Map<String, Object>) schema; +Object discriminator = schemaMap.get("discriminator"); +if (discriminator != null) { +schemaMap.put("discriminator", new JsonMapObject( +Collections.singletonMap("propertyName", discriminator))); +} +} +} + comps.setProperty("schemas", s2Defs); } JsonMapObject s2SecurityDefs = sw2.getJsonMapProperty("securityDefinitions"); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: Ensuring OpenApiFeature.DefaultApplication does only consider the classes from the specified resourcePackages (if provided)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new e7b178a Ensuring OpenApiFeature.DefaultApplication does only consider the classes from the specified resourcePackages (if provided) e7b178a is described below commit e7b178a92302786eca0233f9d176ded2d9086dde Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Thu Feb 8 14:14:11 2018 +0100 Ensuring OpenApiFeature.DefaultApplication does only consider the classes from the specified resourcePackages (if provided) --- .../apache/cxf/jaxrs/openapi/OpenApiFeature.java | 32 ++ 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiFeature.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiFeature.java index c327b1f..68f837c 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiFeature.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiFeature.java @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Properties; @@ -40,6 +41,7 @@ import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.AbstractFeature; import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean; import org.apache.cxf.jaxrs.model.ApplicationInfo; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.jaxrs.swagger.SwaggerUiSupport; @@ -99,11 +101,19 @@ public class OpenApiFeature extends AbstractFeature implements SwaggerUiSupport, private String propertiesLocation = DEFAULT_PROPS_LOCATION; protected static class DefaultApplication extends Application { + private final Set<Class> serviceClasses; - -DefaultApplication(Set<Class> serviceClasses) { -this.serviceClasses = serviceClasses; + +DefaultApplication(final List cris, final Set resourcePackages) { +this.serviceClasses = cris.stream().map(ClassResourceInfo::getServiceClass). +filter(cls -> { +return resourcePackages == null || resourcePackages.isEmpty() + ? true + : resourcePackages.stream(). + anyMatch(pkg -> cls.getPackage().getName().startsWith(pkg)); +}).collect(Collectors.toSet()); } + @Override public Set<Class> getClasses() { return serviceClasses; @@ -424,21 +434,21 @@ public class OpenApiFeature extends AbstractFeature implements SwaggerUiSupport, } /** - * Detects the application (if present) or creates the default application (in case the - * scan is disabled) + * Detects the application (if present) or creates the default application (in case the scan is disabled). */ -protected Application getApplicationOrDefault(Server server, ServerProviderFactory factory, -JAXRSServiceFactoryBean sfb, Bus bus) { +protected Application getApplicationOrDefault( +final Server server, +final ServerProviderFactory factory, +final JAXRSServiceFactoryBean sfb, +final Bus bus) { ApplicationInfo appInfo = null; if (!isScan()) { appInfo = factory.getApplicationProvider(); if (appInfo == null) { -Set<Class> serviceClasses = sfb.getClassResourceInfo().stream(). -map(cri -> cri.getServiceClass()). -collect(Collectors.toSet()); -appInfo = new ApplicationInfo(new DefaultApplication(serviceClasses), bus); +appInfo = new ApplicationInfo( +new DefaultApplication(sfb.getClassResourceInfo(), resourcePackages), bus); server.getEndpoint().put(Application.class.getName(), appInfo); } } -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: Replace with javadocs only if no info was already provided by Swagger annotations
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 25126bf Replace with javadocs only if no info was already provided by Swagger annotations 25126bf is described below commit 25126bfa72893dc16c234565b4168f1fec4e8918 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Thu Feb 15 12:23:29 2018 +0100 Replace with javadocs only if no info was already provided by Swagger annotations --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 33 +++--- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index 88978ef..f3dad04 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -44,14 +44,20 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; public class OpenApiCustomizer { + private boolean dynamicBasePath; + private boolean replaceTags; + private DocumentationProvider javadocProvider; + private List cris; + private String applicationPath; public OpenAPIConfiguration customize(final OpenAPIConfiguration configuration) { @@ -61,12 +67,12 @@ public class OpenApiCustomizer { if (dynamicBasePath) { final MessageContext ctx = createMessageContext(); - + // If the JAX-RS application with custom path is defined, it might be present twice, in the // request URI as well as in each resource operation URI. To properly represent server URL, // the application path should be removed from it. final String url = StringUtils.removeEnd( - StringUtils.substringBeforeLast(ctx.getUriInfo().getRequestUri().toString(), "/"), + StringUtils.substringBeforeLast(ctx.getUriInfo().getRequestUri().toString(), "/"), applicationPath); final Collection servers = configuration.getOpenAPI().getServers(); @@ -118,15 +124,19 @@ public class OpenApiCustomizer { if (methods.containsKey(key) && javadocProvider != null) { OperationResourceInfo ori = methods.get(key); - subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +if (StringUtils.isBlank(subentry.getValue().getSummary())) { + subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +} if (subentry.getValue().getParameters() == null) { List parameters = new ArrayList<>(); addParameters(parameters); subentry.getValue().setParameters(parameters); } else { for (int i = 0; i < subentry.getValue().getParameters().size(); i++) { -subentry.getValue().getParameters().get(i). - setDescription(javadocProvider.getMethodParameterDoc(ori, i)); +if (StringUtils.isBlank(subentry.getValue().getParameters().get(i).getDescription())) { +subentry.getValue().getParameters().get(i). + setDescription(javadocProvider.getMethodParameterDoc(ori, i)); +} } addParameters(subentry.getValue().getParameters()); } @@ -134,8 +144,11 @@ public class OpenApiCustomizer { if (subentry.getValue().getResponses() != null && !subentry.getValue().getResponses().isEmpty()) { - subentry.getValue().getResponses().entrySet().iterator().next().getValue(). - setDescription(javadocProvider.getMethodResponseDoc(ori)); +ApiResponse response = + subentry.getValue().getResponses().entrySet().iterator().next().getValue(); +
[cxf] branch 3.1.x-fixes updated (26fb2ed -> 9d0560a)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git. from 26fb2ed [CXF-7637] Support for 'discriminator' new d7122e3 Replace with javadocs only if no info was already provided by Swagger annotations new 9d0560a [CXF-7637] Fix response The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../cxf/jaxrs/swagger/Swagger2Customizer.java | 27 +++- .../openapi/SwaggerToOpenApiConversionUtils.java | 48 -- 2 files changed, 43 insertions(+), 32 deletions(-) -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] 02/02: [CXF-7637] Fix response
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git commit 9d0560a8ec63c4f6e04693386072ce84d404e1dd Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Thu Feb 15 10:59:19 2018 +0100 [CXF-7637] Fix response --- .../openapi/SwaggerToOpenApiConversionUtils.java | 48 -- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index f5358b6..f523377 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -191,40 +191,44 @@ public final class SwaggerToOpenApiConversionUtils { } private static void prepareResponses(JsonMapObject sw2PathVerbProps) { -List sw2PathVerbProduces = - CastUtils.cast((List)sw2PathVerbProps.removeProperty("produces")); - -JsonMapObject sw3PathVerbResps = null; +List sw2PathVerbProduces = CastUtils.cast((List) sw2PathVerbProps.removeProperty("produces")); + JsonMapObject sw2PathVerbResps = sw2PathVerbProps.getJsonMapProperty("responses"); if (sw2PathVerbResps != null) { -sw3PathVerbResps = new JsonMapObject(); - -JsonMapObject okResp = null; -if (sw2PathVerbResps.containsProperty("200")) { -Map<String, Object> map = CastUtils.cast((Map)sw2PathVerbResps.removeProperty("200")); -okResp = new JsonMapObject(map); -JsonMapObject newOkResp = new JsonMapObject(); -String description = okResp.getStringProperty("description"); +JsonMapObject sw3PathVerbResps = new JsonMapObject(); + +for (Map.Entry<String, Object> entry : sw2PathVerbResps.asMap().entrySet()) { +JsonMapObject v2Resp = new JsonMapObject(sw2PathVerbResps.getMapProperty(entry.getKey())); +JsonMapObject v3Resp = new JsonMapObject(); +String description = v2Resp.getStringProperty("description"); if (description != null) { -newOkResp.setProperty("description", description); +v3Resp.setProperty("description", description); } -JsonMapObject schema = okResp.getJsonMapProperty("schema"); +JsonMapObject schema = v2Resp.getJsonMapProperty("schema"); if (schema != null) { JsonMapObject content = prepareContentFromSchema(schema, sw2PathVerbProduces, false); if (content != null) { -newOkResp.setProperty("content", content); +v3Resp.setProperty("content", content); } - + } -JsonMapObject headers = okResp.getJsonMapProperty("headers"); +JsonMapObject headers = v2Resp.getJsonMapProperty("headers"); if (headers != null) { -newOkResp.setProperty("headers", headers); +for (Map.Entry<String, Object> header: headers.asMap().entrySet()) { +JsonMapObject headerObj = new JsonMapObject(headers.getMapProperty(header.getKey())); +String type = headerObj.getStringProperty("type"); +if (type != null) { +JsonMapObject headerSchema = new JsonMapObject(); +headerSchema.setProperty("type", type); +headerObj.removeProperty("type"); +headerObj.setProperty("schema", headerSchema); +} +} +v3Resp.setProperty("headers", headers); } -sw3PathVerbResps.setProperty("200", newOkResp); -} -for (Map.Entry<String, Object> entry : sw2PathVerbResps.asMap().entrySet()) { -sw3PathVerbResps.setProperty(entry.getKey(), entry.getValue()); +sw3PathVerbResps.setProperty(entry.getKey(), v3Resp); } + sw2PathVerbProps.setProperty("responses", sw3PathVerbResps); } } -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] 01/02: Replace with javadocs only if no info was already provided by Swagger annotations
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git commit d7122e325876225a9219399bbdd05a7e6450a50b Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Thu Feb 15 10:58:44 2018 +0100 Replace with javadocs only if no info was already provided by Swagger annotations --- .../cxf/jaxrs/swagger/Swagger2Customizer.java | 27 ++ 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java index bbfc4b7..8b27b51 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java @@ -39,6 +39,7 @@ import io.swagger.jaxrs.config.BeanConfig; import io.swagger.models.HttpMethod; import io.swagger.models.Operation; import io.swagger.models.Path; +import io.swagger.models.Response; import io.swagger.models.Swagger; import io.swagger.models.Tag; import io.swagger.models.parameters.Parameter; @@ -56,7 +57,6 @@ public class Swagger2Customizer { protected BeanConfig beanConfig; public Swagger customize(Swagger data) { - if (dynamicBasePath) { MessageContext ctx = createMessageContext(); String currentBasePath = StringUtils.substringBeforeLast(ctx.getHttpServletRequest().getRequestURI(), "/"); @@ -65,9 +65,9 @@ public class Swagger2Customizer { data.setHost(beanConfig.getHost()); data.setInfo(beanConfig.getInfo()); } -if (beanConfig.getSwagger() != null -&& beanConfig.getSwagger().getSecurityDefinitions() != null -&& data.getSecurityDefinitions() == null) { +if (beanConfig.getSwagger() != null +&& beanConfig.getSwagger().getSecurityDefinitions() != null +&& data.getSecurityDefinitions() == null) { data.setSecurityDefinitions(beanConfig.getSwagger().getSecurityDefinitions()); } } @@ -111,18 +111,25 @@ public class Swagger2Customizer { if (methods.containsKey(key) && javadocProvider != null) { OperationResourceInfo ori = methods.get(key); - subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +if (StringUtils.isBlank(subentry.getValue().getSummary())) { + subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +} for (int i = 0; i < subentry.getValue().getParameters().size(); i++) { -subentry.getValue().getParameters().get(i). - setDescription(javadocProvider.getMethodParameterDoc(ori, i)); +if (StringUtils.isBlank(subentry.getValue().getParameters().get(i).getDescription())) { +subentry.getValue().getParameters().get(i). + setDescription(javadocProvider.getMethodParameterDoc(ori, i)); +} } addParameters(subentry.getValue().getParameters()); if (subentry.getValue().getResponses() != null && !subentry.getValue().getResponses().isEmpty()) { - subentry.getValue().getResponses().entrySet().iterator().next().getValue(). - setDescription(javadocProvider.getMethodResponseDoc(ori)); +Response response = + subentry.getValue().getResponses().entrySet().iterator().next().getValue(); +if (StringUtils.isBlank(response.getDescription())) { + response.setDescription(javadocProvider.getMethodResponseDoc(ori)); +} } } } @@ -142,7 +149,7 @@ public class Swagger2Customizer { private MessageContext createMessageContext() { return JAXRSUtils.createContextValue( - JAXRSUtils.getCurrentMessage(), null, MessageContext.class); +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); } protected String getNormalizedPath(String classResourcePath, String operationResourcePath) { -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch 3.1.x-fixes updated: [CXF-7525] Support dynamic basePath (when used via Swagger2Customizer) and fix recursive ref under components/schemas
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new def576f [CXF-7525] Support dynamic basePath (when used via Swagger2Customizer) and fix recursive ref under components/schemas def576f is described below commit def576ff5f1fccc0115a929377af0a017ca25104 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Tue Jan 2 16:14:06 2018 +0100 [CXF-7525] Support dynamic basePath (when used via Swagger2Customizer) and fix recursive ref under components/schemas --- .../openapi/SwaggerToOpenApiConversionFilter.java | 15 +-- .../openapi/SwaggerToOpenApiConversionUtils.java | 50 -- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java index 88332ca..3da18a4 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java @@ -33,6 +33,7 @@ import javax.ws.rs.ext.WriterInterceptorContext; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.CachedOutputStream; +import org.apache.cxf.jaxrs.ext.MessageContext; import org.apache.cxf.jaxrs.utils.JAXRSUtils; @Provider @@ -42,7 +43,7 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF private static final String SWAGGER_PATH = "swagger.json"; private static final String OPEN_API_PATH = "openapi.json"; private static final String OPEN_API_PROPERTY = "openapi"; - + private OpenApiConfiguration openApiConfig; @Override public void filter(ContainerRequestContext reqCtx) throws IOException { @@ -51,9 +52,9 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF reqCtx.setRequestUri(URI.create(SWAGGER_PATH)); JAXRSUtils.getCurrentMessage().getExchange().put(OPEN_API_PROPERTY, Boolean.TRUE); } - + } - + public OpenApiConfiguration getOpenApiConfig() { return openApiConfig; } @@ -70,7 +71,8 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF context.setOutputStream(cos); context.proceed(); String swaggerJson = IOUtils.readStringFromStream(cos.getInputStream()); -String openApiJson = SwaggerToOpenApiConversionUtils.getOpenApiFromSwaggerJson(swaggerJson, openApiConfig); +String openApiJson = SwaggerToOpenApiConversionUtils.getOpenApiFromSwaggerJson( +createMessageContext(), swaggerJson, openApiConfig); os.write(StringUtils.toBytesUTF8(openApiJson)); os.flush(); } else { @@ -78,6 +80,11 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF } } +private MessageContext createMessageContext() { +return JAXRSUtils.createContextValue( +JAXRSUtils.getCurrentMessage(), null, MessageContext.class); +} + private boolean isOpenApiRequested() { return Boolean.TRUE == JAXRSUtils.getCurrentMessage().getExchange().get(OPEN_API_PROPERTY); } diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index fbfdb43..63e3274 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -20,6 +20,7 @@ package org.apache.cxf.jaxrs.swagger.openapi; import java.io.IOException; import java.io.InputStream; +import java.net.URI; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; @@ -35,6 +36,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.helpers.IOUtils; +import org.apache.cxf.jaxrs.ext.MessageContext; import org.apache.cxf.jaxrs.json.basic.JsonMapObject; import org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter; import org.apache.cxf.jaxrs.utils.ExceptionUtils; @@ -77,14 +79,16 @@ public final class SwaggerToOpenApiConversionUtils { } public static String get
[cxf] branch 3.2.x-fixes updated: private -> protected + some lambda goodness
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.2.x-fixes by this push: new c59005d private -> protected + some lambda goodness c59005d is described below commit c59005dc9ea4a257f5f0abe80906f96bf99ec00f Author: Francesco Chicchiriccò AuthorDate: Fri Aug 3 09:32:51 2018 +0200 private -> protected + some lambda goodness --- .../apache/cxf/jaxrs/client/AbstractClient.java| 116 + .../apache/cxf/jaxrs/client/ClientProxyImpl.java | 286 ++--- .../cxf/jaxrs/client/JAXRSClientFactoryBean.java | 61 ++--- 3 files changed, 233 insertions(+), 230 deletions(-) diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java index d8bd43f..223e45d 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java @@ -137,6 +137,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client query(String name, Object...values) { addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.QUERY, null, values); return this; @@ -145,6 +146,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client header(String name, Object... values) { if (values == null) { throw new IllegalArgumentException(); @@ -166,6 +168,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client headers(MultivaluedMap map) { state.getRequestHeaders().putAll(map); return this; @@ -174,6 +177,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client accept(MediaType... types) { for (MediaType mt : types) { possiblyAddHeader(HttpHeaders.ACCEPT, JAXRSUtils.mediaTypeToString(mt)); @@ -184,6 +188,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client type(MediaType ct) { return type(JAXRSUtils.mediaTypeToString(ct)); } @@ -191,6 +196,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client type(String type) { state.getRequestHeaders().putSingle(HttpHeaders.CONTENT_TYPE, type); return this; @@ -199,6 +205,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client accept(String... types) { for (String type : types) { possiblyAddHeader(HttpHeaders.ACCEPT, type); @@ -209,6 +216,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client cookie(Cookie cookie) { possiblyAddHeader(HttpHeaders.COOKIE, cookie.toString()); return this; @@ -217,6 +225,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client authorization(Object auth) { String value = convertParamValue(auth, null); state.getRequestHeaders().putSingle(HttpHeaders.AUTHORIZATION, value); @@ -226,6 +235,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client modified(Date date, boolean ifNot) { SimpleDateFormat dateFormat = HttpUtils.getHttpDateFormat(); String hName = ifNot ? HttpHeaders.IF_UNMODIFIED_SINCE : HttpHeaders.IF_MODIFIED_SINCE; @@ -236,6 +246,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client language(String language) { state.getRequestHeaders().putSingle(HttpHeaders.CONTENT_LANGUAGE, language); return this; @@ -244,6 +255,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client match(EntityTag tag, boolean ifNot) { String hName = ifNot ? HttpHeaders.IF_NONE_MATCH : HttpHeaders.IF_MATCH; state.getRequestHeaders().putSingle(hName, tag.toString()); @@ -253,6 +265,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client acceptLanguage(String... languages) { for (String s : languages) { possiblyAddHeader(HttpHeaders.ACCEPT_LANGUAGE, s); @@ -263,6 +276,7 @@ public abstract class AbstractClient implements
[cxf] branch master updated: private -> protected + some lambda goodness
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 1257719 private -> protected + some lambda goodness 1257719 is described below commit 1257719ba6030cb2e94a4cfcdfcf583a51a8817c Author: Francesco Chicchiriccò AuthorDate: Fri Aug 3 09:32:51 2018 +0200 private -> protected + some lambda goodness --- .../apache/cxf/jaxrs/client/AbstractClient.java| 116 + .../apache/cxf/jaxrs/client/ClientProxyImpl.java | 286 ++--- .../cxf/jaxrs/client/JAXRSClientFactoryBean.java | 61 ++--- 3 files changed, 233 insertions(+), 230 deletions(-) diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java index d8bd43f..223e45d 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java @@ -137,6 +137,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client query(String name, Object...values) { addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.QUERY, null, values); return this; @@ -145,6 +146,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client header(String name, Object... values) { if (values == null) { throw new IllegalArgumentException(); @@ -166,6 +168,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client headers(MultivaluedMap map) { state.getRequestHeaders().putAll(map); return this; @@ -174,6 +177,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client accept(MediaType... types) { for (MediaType mt : types) { possiblyAddHeader(HttpHeaders.ACCEPT, JAXRSUtils.mediaTypeToString(mt)); @@ -184,6 +188,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client type(MediaType ct) { return type(JAXRSUtils.mediaTypeToString(ct)); } @@ -191,6 +196,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client type(String type) { state.getRequestHeaders().putSingle(HttpHeaders.CONTENT_TYPE, type); return this; @@ -199,6 +205,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client accept(String... types) { for (String type : types) { possiblyAddHeader(HttpHeaders.ACCEPT, type); @@ -209,6 +216,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client cookie(Cookie cookie) { possiblyAddHeader(HttpHeaders.COOKIE, cookie.toString()); return this; @@ -217,6 +225,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client authorization(Object auth) { String value = convertParamValue(auth, null); state.getRequestHeaders().putSingle(HttpHeaders.AUTHORIZATION, value); @@ -226,6 +235,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client modified(Date date, boolean ifNot) { SimpleDateFormat dateFormat = HttpUtils.getHttpDateFormat(); String hName = ifNot ? HttpHeaders.IF_UNMODIFIED_SINCE : HttpHeaders.IF_MODIFIED_SINCE; @@ -236,6 +246,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client language(String language) { state.getRequestHeaders().putSingle(HttpHeaders.CONTENT_LANGUAGE, language); return this; @@ -244,6 +255,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client match(EntityTag tag, boolean ifNot) { String hName = ifNot ? HttpHeaders.IF_NONE_MATCH : HttpHeaders.IF_MATCH; state.getRequestHeaders().putSingle(hName, tag.toString()); @@ -253,6 +265,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ +@Override public Client acceptLanguage(String... languages) { for (String s : languages) { possiblyAddHeader(HttpHeaders.ACCEPT_LANGUAGE, s); @@ -263,6 +276,7 @@ public abstract class AbstractClient implements
[cxf] branch 3.1.x-fixes updated: Fixing folded schema references
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new e1ddbc3 Fixing folded schema references e1ddbc3 is described below commit e1ddbc39c7a1c2cc0e0d653fc7d839e10afb6a89 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Fri Apr 6 11:33:13 2018 +0200 Fixing folded schema references --- .../cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index 1ff9b2e..ae2e02c 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -128,7 +128,7 @@ public final class SwaggerToOpenApiConversionUtils { sw3.setProperty("externalDocs", externalDocsObject); } -return readerWriter.toJson(sw3); +return readerWriter.toJson(sw3).replace("#/definitions/", "#/components/schemas/"); } private static void setComponentsProperty( @@ -340,8 +340,7 @@ public final class SwaggerToOpenApiConversionUtils { if (requestBodyName != null) { requestBodies.put(requestBodyName, sw3RequestBody); String ref = "#/components/requestBodies/" + requestBodyName; -sw2PathVerbProps.setProperty("requestBody", -Collections.singletonMap("$ref", ref)); +sw2PathVerbProps.setProperty("requestBody", Collections.singletonMap("$ref", ref)); } } } -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: Upgrade swagger-jaxrs2
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 96cf54c Upgrade swagger-jaxrs2 96cf54c is described below commit 96cf54c8577abb504113065c7c8f4e3d86b84bf9 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Wed Apr 18 10:23:31 2018 +0200 Upgrade swagger-jaxrs2 --- parent/pom.xml | 2 +- .../description/openapi/AbstractOpenApiServiceDescriptionTest.java | 5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/parent/pom.xml b/parent/pom.xml index d956a2b..1efd1f4 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -160,7 +160,7 @@ 2.3.2.RELEASE spring-test 1.5.17 -2.0.0 +2.0.1 3.13.3 2.0 5.0.3 diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java index 0e8654f..d81ff8a 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java @@ -160,10 +160,7 @@ public abstract class AbstractOpenApiServiceDescriptionTest extends AbstractBusC UserOperation getBooksOp = map.get("getBooks"); assertEquals(HttpMethod.GET, getBooksOp.getVerb()); assertEquals(getApplicationPath() + "/bookstore", getBooksOp.getPath()); -// see https://github.com/swagger-api/swagger-core/issues/2646 -if (getBooksOp.getProduces() != null) { -assertEquals(MediaType.APPLICATION_JSON, getBooksOp.getProduces()); -} +assertEquals(MediaType.APPLICATION_JSON, getBooksOp.getProduces()); List getBooksOpParams = getBooksOp.getParameters(); assertEquals(1, getBooksOpParams.size()); assertEquals(ParameterType.QUERY, getBooksOpParams.get(0).getType()); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: Reverting to swagger-jaxrs 2.0.0
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 3567841 Reverting to swagger-jaxrs 2.0.0 3567841 is described below commit 3567841e2449ff62dd3517b7c64134a587e02d64 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Wed Apr 18 11:06:37 2018 +0200 Reverting to swagger-jaxrs 2.0.0 --- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent/pom.xml b/parent/pom.xml index 1efd1f4..d956a2b 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -160,7 +160,7 @@ 2.3.2.RELEASE spring-test 1.5.17 -2.0.1 +2.0.0 3.13.3 2.0 5.0.3 -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch master updated: Upgrading swagger-jaxrs2 to 2.0.0 stable
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new b703732 Upgrading swagger-jaxrs2 to 2.0.0 stable b703732 is described below commit b703732ce05ff8b204648fb36c90041814b349b9 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Wed Mar 28 10:21:16 2018 +0200 Upgrading swagger-jaxrs2 to 2.0.0 stable --- parent/pom.xml | 2 +- .../src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java | 5 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/parent/pom.xml b/parent/pom.xml index 020b86d..623a5b8 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -160,7 +160,7 @@ 2.3.2.RELEASE spring-test 1.5.17 -2.0.0-rc4 +2.0.0 3.13.0 2.0 5.0.3 diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java index aa345d9..40deb00 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/JaxRs2Extension.java @@ -38,6 +38,8 @@ import javax.validation.constraints.Size; import javax.ws.rs.Consumes; import javax.ws.rs.MatrixParam; +import com.fasterxml.jackson.annotation.JsonView; + import io.swagger.v3.core.converter.ModelConverters; import io.swagger.v3.core.converter.ResolvedSchema; import io.swagger.v3.jaxrs2.ResolvedParameter; @@ -62,6 +64,7 @@ public class JaxRs2Extension extends AbstractOpenAPIExtension { final Consumes classConsumes, final Consumes methodConsumes, final boolean includeRequestBody, +final JsonView jsonViewAnnotation, final Iterator chain) { if (shouldIgnoreType(type, typesToSkip)) { @@ -88,7 +91,7 @@ public class JaxRs2Extension extends AbstractOpenAPIExtension { if (parameters.isEmpty()) { return super.extractParameters( annotations, type, typesToSkip, components, classConsumes, -methodConsumes, includeRequestBody, chain); +methodConsumes, includeRequestBody, jsonViewAnnotation, chain); } ResolvedParameter resolved = new ResolvedParameter(); -- To stop receiving notification emails like this one, please contact ilgro...@apache.org.
[cxf] branch 3.1.x-fixes updated: Fixing SwaggerToOpenApiConversionUtils against recent OpenApi 3.0.1
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.1.x-fixes by this push: new 1146722 Fixing SwaggerToOpenApiConversionUtils against recent OpenApi 3.0.1 1146722 is described below commit 11467221746a050e21ae9d1df5817887392db99b Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Mon Mar 19 16:57:58 2018 +0100 Fixing SwaggerToOpenApiConversionUtils against recent OpenApi 3.0.1 --- .../openapi/SwaggerToOpenApiConversionUtils.java | 145 - .../SwaggerToOpenApiConversionUtilsTest.java | 11 +- 2 files changed, 85 insertions(+), 71 deletions(-) diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java index f523377..1ff9b2e 100644 --- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java +++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java @@ -29,6 +29,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Logger; +import javax.ws.rs.core.MediaType; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; @@ -87,58 +88,63 @@ public final class SwaggerToOpenApiConversionUtils { } public static String getOpenApiFromSwaggerJson( -MessageContext ctx, String json, OpenApiConfiguration cfg) throws IOException { +final MessageContext ctx, +final String json, +final OpenApiConfiguration cfg) throws IOException { JsonMapObjectReaderWriter readerWriter = new JsonMapObjectReaderWriter(); JsonMapObject sw2 = readerWriter.fromJsonToJsonObject(json); JsonMapObject sw3 = new JsonMapObject(); - + // "openapi" -sw3.setProperty("openapi", "3.0.0"); - +sw3.setProperty("openapi", "3.0.1"); + // "servers" setServersProperty(ctx, sw2, sw3); - + // "info" JsonMapObject infoObject = sw2.getJsonMapProperty("info"); if (infoObject != null) { sw3.setProperty("info", infoObject); } - + // "tags" List<Map<String, Object>> tagsObject = sw2.getListMapProperty("tags"); if (tagsObject != null) { sw3.setProperty("tags", tagsObject); } - + // paths -Map<String, JsonMapObject> requestBodies = cfg != null && cfg.isCreateRequestBodies() -? new LinkedHashMap<String, JsonMapObject>() : null; +Map<String, JsonMapObject> requestBodies = cfg != null && cfg.isCreateRequestBodies() +? new LinkedHashMap<String, JsonMapObject>() : null; setPathsProperty(sw2, sw3, requestBodies); - + // components setComponentsProperty(sw2, sw3, requestBodies); - + // externalDocs Object externalDocsObject = sw2.getProperty("externalDocs"); if (externalDocsObject != null) { sw3.setProperty("externalDocs", externalDocsObject); } - -return readerWriter.toJson(sw3).replace("#/definitions/", "#/components/schemas/"); + +return readerWriter.toJson(sw3); } - -private static void setComponentsProperty(JsonMapObject sw2, JsonMapObject sw3, - Map<String, JsonMapObject> requestBodies) { + +private static void setComponentsProperty( +final JsonMapObject sw2, +final JsonMapObject sw3, +final Map<String, JsonMapObject> requestBodies) { + JsonMapObject comps = new JsonMapObject(); -JsonMapObject requestBodiesObj = new JsonMapObject(); +JsonMapObject requestBodiesObj = new JsonMapObject(); if (requestBodies != null) { for (Map.Entry<String, JsonMapObject> entry : requestBodies.entrySet()) { requestBodiesObj.setProperty(entry.getKey(), entry.getValue()); } } comps.setProperty("requestBodies", requestBodiesObj); - + JsonMapObject s2Defs = sw2.getJsonMapProperty("definitions"); if (s2Defs != null) { for (Object schema : s2Defs.asMap().values()) { @@ -152,7 +158,7 @@ public final class SwaggerToOpenApiConversionUtils { }
[cxf] branch 3.2.x-fixes updated: Allow more customization of Operation responses
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.2.x-fixes by this push: new 4c64888 Allow more customization of Operation responses 4c64888 is described below commit 4c64888f93f15eef4ff6fc64c75f483a28c864ce Author: Francesco Chicchiriccò AuthorDate: Fri Oct 5 15:09:12 2018 +0200 Allow more customization of Operation responses --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 31 +++--- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index f3dad04..abdc7b7 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -39,6 +39,7 @@ import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.cxf.jaxrs.utils.ResourceUtils; +import io.swagger.v3.jaxrs2.Reader; import io.swagger.v3.oas.integration.api.OpenAPIConfiguration; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -127,6 +128,7 @@ public class OpenApiCustomizer { if (StringUtils.isBlank(subentry.getValue().getSummary())) { subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); } + if (subentry.getValue().getParameters() == null) { List parameters = new ArrayList<>(); addParameters(parameters); @@ -141,15 +143,7 @@ public class OpenApiCustomizer { addParameters(subentry.getValue().getParameters()); } -if (subentry.getValue().getResponses() != null -&& !subentry.getValue().getResponses().isEmpty()) { - -ApiResponse response = - subentry.getValue().getResponses().entrySet().iterator().next().getValue(); -if (StringUtils.isBlank(response.getDescription())) { - response.setDescription(javadocProvider.getMethodResponseDoc(ori)); -} -} +customizeResponses(subentry.getValue(), ori); } } }); @@ -190,6 +184,25 @@ public class OpenApiCustomizer { // does nothing by default } +/** + * Allows to customize the responses of the given {@link Operation} instance; the method is invoked + * for all instances available. + * + * @param operation operation instance + * @param ori CXF data about the given operation instance + */ +protected void customizeResponses(final Operation operation, final OperationResourceInfo ori) { +if (operation.getResponses() != null && !operation.getResponses().isEmpty()) { +ApiResponse response = operation.getResponses().entrySet().iterator().next().getValue(); +if (StringUtils.isBlank(response.getDescription()) +|| (StringUtils.isNotBlank(javadocProvider.getMethodResponseDoc(ori)) +&& Reader.DEFAULT_DESCRIPTION.equals(response.getDescription( { + + response.setDescription(javadocProvider.getMethodResponseDoc(ori)); +} +} +} + public void setDynamicBasePath(final boolean dynamicBasePath) { this.dynamicBasePath = dynamicBasePath; }
[cxf] branch master updated (1542c81 -> d687350)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git. from 1542c81 Put MP Rest Client invokedMethod in ClientRequestContext properties add d687350 Allow more customization of Operation responses No new revisions were added by this update. Summary of changes: .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 31 +++--- 1 file changed, 22 insertions(+), 9 deletions(-)
[cxf] branch master updated: [CXF-7968] Handle javadoc's operation link for JDK > 1.8
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 6307f63 [CXF-7968] Handle javadoc's operation link for JDK > 1.8 6307f63 is described below commit 6307f6334302c370b8a463914c963f4f644ce536 Author: Francesco Chicchiriccò AuthorDate: Fri Feb 8 15:29:43 2019 +0100 [CXF-7968] Handle javadoc's operation link for JDK > 1.8 --- .../main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java index 7ac4c17..e556702 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java @@ -297,9 +297,14 @@ public class JavaDocProvider implements DocumentationProvider { } return ""; } + protected String getOperLink() { String operLink = "
[cxf] branch master updated: Prevent NPE when outMessage is null
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 67f5bef Prevent NPE when outMessage is null 67f5bef is described below commit 67f5befafa7b9aeb831451dbccd3a7e8993b456d Author: Francesco Chicchiriccò AuthorDate: Thu Apr 18 16:34:50 2019 +0200 Prevent NPE when outMessage is null --- .../jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java index 217203d..d23ce98 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java @@ -238,10 +238,10 @@ public final class ResponseImpl extends Response { public URI getLocation() { Object header = metadata.getFirst(HttpHeaders.LOCATION); -if (header == null) { +if (header == null && outMessage != null) { header = outMessage.get(Message.REQUEST_URI); } -return header == null || header instanceof URI ? (URI)header +return header == null || header instanceof URI ? (URI) header : URI.create(header.toString()); }
[cxf] branch 3.2.x-fixes updated: Prevent NPE when outMessage is null
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.2.x-fixes by this push: new ba400d9 Prevent NPE when outMessage is null ba400d9 is described below commit ba400d90f27659b52430e51f52f2dedbcce944c5 Author: Francesco Chicchiriccò AuthorDate: Thu Apr 18 16:34:50 2019 +0200 Prevent NPE when outMessage is null --- .../jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java index 0dfeec0..68aa78f 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java @@ -238,10 +238,10 @@ public final class ResponseImpl extends Response { public URI getLocation() { Object header = metadata.getFirst(HttpHeaders.LOCATION); -if (header == null) { +if (header == null && outMessage != null) { header = outMessage.get(Message.REQUEST_URI); } -return header == null || header instanceof URI ? (URI)header +return header == null || header instanceof URI ? (URI) header : URI.create(header.toString()); }
[cxf] branch master updated: [CXF-8158] Fixing checkstyle
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 9d8cded [CXF-8158] Fixing checkstyle 9d8cded is described below commit 9d8cdedc850f284a30f999897b6e4bc3e1a46b79 Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 15:41:23 2019 +0100 [CXF-8158] Fixing checkstyle --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 33 +++--- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index e4964fc..8ed43b5 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import javax.ws.rs.ApplicationPath; @@ -48,7 +49,6 @@ import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; -import java.util.Objects; public class OpenApiCustomizer { @@ -136,26 +136,27 @@ public class OpenApiCustomizer { List parameters = new ArrayList<>(); addParameters(parameters); operation.setParameters(parameters); -} else { -for (int i = 0; i < operation.getParameters().size(); i++) { -if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} +} + +for (int i = 0; i < operation.getParameters().size(); i++) { +if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, i); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( + operation.getParameters().get(i).getName(), + ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); } } - operation.getParameters().get(i).setDescription(javadoc); } + operation.getParameters().get(i).setDescription(javadoc); } } + addParameters(operation.getParameters()); customizeResponses(operation, ori);
[cxf] branch 3.2.x-fixes updated: [CXF-8158] Fixing checkstyle
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.2.x-fixes by this push: new e125a55 [CXF-8158] Fixing checkstyle e125a55 is described below commit e125a552b02c4b7cbf3d6603b18f20e1be78380d Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 15:41:23 2019 +0100 [CXF-8158] Fixing checkstyle --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 33 +++--- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index f987b25..719ecc1 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import javax.ws.rs.ApplicationPath; @@ -48,7 +49,6 @@ import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; -import java.util.Objects; public class OpenApiCustomizer { @@ -136,26 +136,27 @@ public class OpenApiCustomizer { List parameters = new ArrayList<>(); addParameters(parameters); operation.setParameters(parameters); -} else { -for (int i = 0; i < operation.getParameters().size(); i++) { -if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} +} + +for (int i = 0; i < operation.getParameters().size(); i++) { +if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, i); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( + operation.getParameters().get(i).getName(), + ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); } } - operation.getParameters().get(i).setDescription(javadoc); } + operation.getParameters().get(i).setDescription(javadoc); } } + addParameters(operation.getParameters()); customizeResponses(operation, ori);
[cxf] branch 3.3.x-fixes updated: [CXF-8158] Fixing checkstyle
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.3.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.3.x-fixes by this push: new 212d1ce [CXF-8158] Fixing checkstyle 212d1ce is described below commit 212d1cee5826e6af48000c5874977fbaeb502f56 Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 15:41:23 2019 +0100 [CXF-8158] Fixing checkstyle --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 33 +++--- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index e4964fc..8ed43b5 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import javax.ws.rs.ApplicationPath; @@ -48,7 +49,6 @@ import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; -import java.util.Objects; public class OpenApiCustomizer { @@ -136,26 +136,27 @@ public class OpenApiCustomizer { List parameters = new ArrayList<>(); addParameters(parameters); operation.setParameters(parameters); -} else { -for (int i = 0; i < operation.getParameters().size(); i++) { -if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} +} + +for (int i = 0; i < operation.getParameters().size(); i++) { +if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, i); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( + operation.getParameters().get(i).getName(), + ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); } } - operation.getParameters().get(i).setDescription(javadoc); } + operation.getParameters().get(i).setDescription(javadoc); } } + addParameters(operation.getParameters()); customizeResponses(operation, ori);
[cxf] branch 3.2.x-fixes updated: [CXF-8158] Fixing checkstyle (take 2)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.2.x-fixes by this push: new bdf1316 [CXF-8158] Fixing checkstyle (take 2) bdf1316 is described below commit bdf1316e13ff14e86e270ea58d6fe3d54f26a840 Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 16:18:35 2019 +0100 [CXF-8158] Fixing checkstyle (take 2) --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 32 -- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index 719ecc1..7a4162c 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -86,6 +86,23 @@ public class OpenApiCustomizer { return configuration; } +protected String extractJavadoc(final Operation operation, final OperationResourceInfo ori, final int paramIdx) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, paramIdx); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( +operation.getParameters().get(paramIdx).getName(), +ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); +} +} +} +return javadoc; +} + public void customize(final OpenAPI oas) { if (replaceTags || javadocProvider != null) { Map operations = new HashMap<>(); @@ -140,20 +157,7 @@ public class OpenApiCustomizer { for (int i = 0; i < operation.getParameters().size(); i++) { if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} -} -} - operation.getParameters().get(i).setDescription(javadoc); + operation.getParameters().get(i).setDescription(extractJavadoc(operation, ori, i)); } }
[cxf] branch 3.3.x-fixes updated: [CXF-8158] Fixing checkstyle (take 2)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.3.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/3.3.x-fixes by this push: new 95b1484 [CXF-8158] Fixing checkstyle (take 2) 95b1484 is described below commit 95b148441611fe337150f5dab1672086f78c0e8a Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 16:18:35 2019 +0100 [CXF-8158] Fixing checkstyle (take 2) --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 32 -- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index 8ed43b5..ea0dff3 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -86,6 +86,23 @@ public class OpenApiCustomizer { return configuration; } +protected String extractJavadoc(final Operation operation, final OperationResourceInfo ori, final int paramIdx) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, paramIdx); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( +operation.getParameters().get(paramIdx).getName(), +ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); +} +} +} +return javadoc; +} + public void customize(final OpenAPI oas) { if (replaceTags || javadocProvider != null) { Map operations = new HashMap<>(); @@ -140,20 +157,7 @@ public class OpenApiCustomizer { for (int i = 0; i < operation.getParameters().size(); i++) { if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} -} -} - operation.getParameters().get(i).setDescription(javadoc); + operation.getParameters().get(i).setDescription(extractJavadoc(operation, ori, i)); } }
[cxf] branch master updated: [CXF-8158] Fixing checkstyle (take 2)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 6c137a5 [CXF-8158] Fixing checkstyle (take 2) 6c137a5 is described below commit 6c137a57a757bd217827050e0e133e330978 Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 16:18:35 2019 +0100 [CXF-8158] Fixing checkstyle (take 2) --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 32 -- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index 8ed43b5..ea0dff3 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -86,6 +86,23 @@ public class OpenApiCustomizer { return configuration; } +protected String extractJavadoc(final Operation operation, final OperationResourceInfo ori, final int paramIdx) { +String javadoc = null; +if (operation.getParameters().size() == ori.getParameters().size()) { +javadoc = javadocProvider.getMethodParameterDoc(ori, paramIdx); +} else { +for (int j = 0; j < ori.getParameters().size(); j++) { +if (Objects.equals( +operation.getParameters().get(paramIdx).getName(), +ori.getParameters().get(j).getName())) { + +javadoc = javadocProvider.getMethodParameterDoc(ori, j); +} +} +} +return javadoc; +} + public void customize(final OpenAPI oas) { if (replaceTags || javadocProvider != null) { Map operations = new HashMap<>(); @@ -140,20 +157,7 @@ public class OpenApiCustomizer { for (int i = 0; i < operation.getParameters().size(); i++) { if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { -String javadoc = null; -if (operation.getParameters().size() == ori.getParameters().size()) { -javadoc = javadocProvider.getMethodParameterDoc(ori, i); -} else { -for (int j = 0; j < ori.getParameters().size(); j++) { -if (Objects.equals( - operation.getParameters().get(i).getName(), - ori.getParameters().get(j).getName())) { - -javadoc = javadocProvider.getMethodParameterDoc(ori, j); -} -} -} - operation.getParameters().get(i).setDescription(javadoc); + operation.getParameters().get(i).setDescription(extractJavadoc(operation, ori, i)); } }
[cxf] 01/02: Various small improvements to OpenApiCustomizer to allow easier override
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch CXF-8158 in repository https://gitbox.apache.org/repos/asf/cxf.git commit ded3d576bd441552dd95ea7a094790f9987f0851 Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 09:27:28 2019 +0100 Various small improvements to OpenApiCustomizer to allow easier override --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 52 +++--- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index f24f2d7..315e1d1 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -43,23 +43,23 @@ import io.swagger.v3.jaxrs2.Reader; import io.swagger.v3.oas.integration.api.OpenAPIConfiguration; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; +import java.util.Optional; public class OpenApiCustomizer { -private boolean dynamicBasePath; +protected boolean dynamicBasePath; -private boolean replaceTags; +protected boolean replaceTags; -private DocumentationProvider javadocProvider; +protected DocumentationProvider javadocProvider; -private List cris; +protected List cris; -private String applicationPath; +protected String applicationPath; public OpenAPIConfiguration customize(final OpenAPIConfiguration configuration) { if (configuration == null) { @@ -101,51 +101,53 @@ public class OpenApiCustomizer { List tags = new ArrayList<>(); oas.getPaths().forEach((pathKey, pathItem) -> { -Tag tag = null; +Optional tag; if (replaceTags && operations.containsKey(pathKey)) { ClassResourceInfo cri = operations.get(pathKey); -tag = new Tag(); +tag = Optional.of(new Tag()); tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri)); } -if (!tags.contains(tag)) { -tags.add(tag); +if (!tags.contains(tag.get())) { +tags.add(tag.get()); } +} else { +tag = Optional.empty(); } -for (Map.Entry subentry : pathItem.readOperationsMap().entrySet()) { -if (replaceTags && tag != null) { - subentry.getValue().setTags(Collections.singletonList(tag.getName())); +pathItem.readOperationsMap().forEach((method, operation) -> { +if (replaceTags && tag.isPresent()) { + operation.setTags(Collections.singletonList(tag.get().getName())); } -Pair key = Pair.of(subentry.getKey().name(), pathKey); +Pair key = Pair.of(method.name(), pathKey); if (methods.containsKey(key) && javadocProvider != null) { OperationResourceInfo ori = methods.get(key); -if (StringUtils.isBlank(subentry.getValue().getSummary())) { - subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +if (StringUtils.isBlank(operation.getSummary())) { + operation.setSummary(javadocProvider.getMethodDoc(ori)); } -if (subentry.getValue().getParameters() == null) { +if (operation.getParameters() == null) { List parameters = new ArrayList<>(); addParameters(parameters); -subentry.getValue().setParameters(parameters); +operation.setParameters(parameters); } else { -for (int i = 0; i < subentry.getValue().getParameters().size(); i++) { -if (StringUtils.isBlank(subentry.getValue().getParameters().get(i).getDescription())) { -subentry.getValue().getParameters().get(i). +
[cxf] branch CXF-8158 created (now 4e285f8)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch CXF-8158 in repository https://gitbox.apache.org/repos/asf/cxf.git. at 4e285f8 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size This branch includes the following new commits: new ded3d57 Various small improvements to OpenApiCustomizer to allow easier override new 4e285f8 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[cxf] 02/02: [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch CXF-8158 in repository https://gitbox.apache.org/repos/asf/cxf.git commit 4e285f885201de23862b12a22234db2f4cfd074e Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 09:28:15 2019 +0100 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size --- .../src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index 315e1d1..edaf049 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -135,7 +135,7 @@ public class OpenApiCustomizer { List parameters = new ArrayList<>(); addParameters(parameters); operation.setParameters(parameters); -} else { +} else if (operation.getParameters().size() == ori.getParameters().size()) { for (int i = 0; i < operation.getParameters().size(); i++) { if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) { operation.getParameters().get(i).
[cxf] branch CXF-8158 updated (d6048d6 -> 6bcf5f1)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch CXF-8158 in repository https://gitbox.apache.org/repos/asf/cxf.git. discard d6048d6 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size add 6bcf5f1 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (d6048d6) \ N -- N -- N refs/heads/CXF-8158 (6bcf5f1) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[cxf] branch CXF-8158 updated (4e285f8 -> d6048d6)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch CXF-8158 in repository https://gitbox.apache.org/repos/asf/cxf.git. discard 4e285f8 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size discard ded3d57 Various small improvements to OpenApiCustomizer to allow easier override add 589e321 Update Jetty add bf1b850 Update examples add 964573a cxf-core: remove unused EndpointReferenceUtils#setMetadata add 6771507 cxf-rt-transports-jms: move test specific JMSUtil#getNumMessages add 277430f Updating Mockito add 189b12e CXF-8139 - SecurityToken, parsing the lifetime may cause a NullPointerException add ab3df13 cxf-core: remove unused AttachmentUtil#getAttachmentPartHeader (#593) add 7041e42 cxf-systests-ws-rm: improve ManagedEndpointsTest stability add 76ceee1 [CXF-8143]ensure java2wadl-plugin m2e compatible add f4060aa cxf-rt-ws-security: fix SecurityTokenTest for Java 11 add ae963c2 cxf-rt-bindings-xml: fix tests for Java 13 add 8df29be [CXF-8140]:setAccessible(true) before reflection method java.security… (#592) add f9f5d45 cxf-integration-jca: fix tests for Java 13 add a9a7302 Make sure that only the client associated with a token can revoke it add 3e2e394 Updating Commons Text + SLF4J add a9375a9 Updating Spring + Spring security add bef9540 Remove MD5 from testcase add 67d670b Make sure we're getting the Session NotOnOrAfter from the right assertion add 5dd277d Parameterize suffix-list data file with cmd line for firewalled build add 007ee0d Update maven-bundle-plugin add d84e9a1 CXF-8144: OpenAPI v3 Feature: duplicated methods. The issue is caused by the Portable feature refactorings, basically half of the Portable*s are annotated with CXF's @Provider annotation, which in case of Spring-based scanning, leads to discovery and registration of both features add 59ba482 CXF-8144: OpenAPI v3 Feature: duplicated methods. The issue is caused by the Portable feature refactorings, basically half of the Portable*s are annotated with CXF's @Provider annotation, which in case of Spring-based scanning, leads to discovery and registration of both features add 041ae41 CXF-8150: Update to Spring Boot 2.1.10 add d5b612c Fixing banned dependencies (jaxb-api) add da4dfee Updating HBase add 407eeb0 cxf-systests-jaxrs: detailed message on test failure add a8d1b38 Updating hibernate entity manager add c811add Updating EhCache add 3e2cdcc Add a property for tarLongFileMode add 6b7e50b CXF-8148: Address OpenJDK14 build failures. The issues have been caused by removal of the deprecated 'java.security.acl' package add a4fc3a04 CXF-8155: Update to Jackson 2.10.1 add 2a30443 Updating owasp plugin add 71b0cee cxf-services-sts-systests-basic: organize TLSClientParameters add d75b938 Adding JWT test add 7ef8145 Revert "CXF-8155: Update to Jackson 2.10.1" add 6e9d9af Various small improvements to OpenApiCustomizer to allow easier override add d6048d6 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (4e285f8) \ N -- N -- N refs/heads/CXF-8158 (d6048d6) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: core/pom.xml | 30 + .../org/apache/cxf/attachment/AttachmentUtil.java | 16 --- .../org/apache/cxf/feature/LoggingFeature.java | 1 - .../security/DefaultSecurityContext.java | 9 +- .../cxf/transport/common/gzip/GZIPFeature.java | 1 - .../cxf/validation/BeanValidationFeature.java | 1 - .../validation/ClientBeanValidationFeature.java| 1 - .../cxf/ws/addressing/EndpointReferenceUtils.java | 63 --- .../security/DefaultSecurityContextTest.java | 1 - .../security/DeprecatedSecurityContextTest.java| 53 + .../interceptor/security/test/GroupWrapper.java| 82 ++ distribution/pom.xml | 5 +- .../main/release/samples/java_first_jaxws/pom.xml | 2 +- .../jax_rs/description_openapi_v3_web/pom
[cxf] branch master updated (7ef8145 -> f490483)
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git. from 7ef8145 Revert "CXF-8155: Update to Jackson 2.10.1" add ade5fdb Various small improvements to OpenApiCustomizer to allow easier override add f490483 [CXF-8158] Only proceed with javadoc description replacement when JAX-RS and OpenAPI parameters have same size No new revisions were added by this update. Summary of changes: .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 58 +++--- 1 file changed, 30 insertions(+), 28 deletions(-)
[cxf] 01/02: Various small improvements to OpenApiCustomizer to allow easier override
This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3.3.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git commit 58a0c9ba8afe47b78d181e5d0eb3f98179cdc8cb Author: Francesco Chicchiriccò AuthorDate: Thu Nov 14 09:27:28 2019 +0100 Various small improvements to OpenApiCustomizer to allow easier override --- .../cxf/jaxrs/openapi/OpenApiCustomizer.java | 52 +++--- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java index f24f2d7..315e1d1 100644 --- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java +++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java @@ -43,23 +43,23 @@ import io.swagger.v3.jaxrs2.Reader; import io.swagger.v3.oas.integration.api.OpenAPIConfiguration; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; +import java.util.Optional; public class OpenApiCustomizer { -private boolean dynamicBasePath; +protected boolean dynamicBasePath; -private boolean replaceTags; +protected boolean replaceTags; -private DocumentationProvider javadocProvider; +protected DocumentationProvider javadocProvider; -private List cris; +protected List cris; -private String applicationPath; +protected String applicationPath; public OpenAPIConfiguration customize(final OpenAPIConfiguration configuration) { if (configuration == null) { @@ -101,51 +101,53 @@ public class OpenApiCustomizer { List tags = new ArrayList<>(); oas.getPaths().forEach((pathKey, pathItem) -> { -Tag tag = null; +Optional tag; if (replaceTags && operations.containsKey(pathKey)) { ClassResourceInfo cri = operations.get(pathKey); -tag = new Tag(); +tag = Optional.of(new Tag()); tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_")); if (javadocProvider != null) { tag.setDescription(javadocProvider.getClassDoc(cri)); } -if (!tags.contains(tag)) { -tags.add(tag); +if (!tags.contains(tag.get())) { +tags.add(tag.get()); } +} else { +tag = Optional.empty(); } -for (Map.Entry subentry : pathItem.readOperationsMap().entrySet()) { -if (replaceTags && tag != null) { - subentry.getValue().setTags(Collections.singletonList(tag.getName())); +pathItem.readOperationsMap().forEach((method, operation) -> { +if (replaceTags && tag.isPresent()) { + operation.setTags(Collections.singletonList(tag.get().getName())); } -Pair key = Pair.of(subentry.getKey().name(), pathKey); +Pair key = Pair.of(method.name(), pathKey); if (methods.containsKey(key) && javadocProvider != null) { OperationResourceInfo ori = methods.get(key); -if (StringUtils.isBlank(subentry.getValue().getSummary())) { - subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori)); +if (StringUtils.isBlank(operation.getSummary())) { + operation.setSummary(javadocProvider.getMethodDoc(ori)); } -if (subentry.getValue().getParameters() == null) { +if (operation.getParameters() == null) { List parameters = new ArrayList<>(); addParameters(parameters); -subentry.getValue().setParameters(parameters); +operation.setParameters(parameters); } else { -for (int i = 0; i < subentry.getValue().getParameters().size(); i++) { -if (StringUtils.isBlank(subentry.getValue().getParameters().get(i).getDescription())) { -subentry.getValue().getParameters().get(i). +