camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] branch master updated: CAMEL-12782 - More specific error message for unresolved model classes. (#2509)
Date Sat, 08 Sep 2018 07:54:15 GMT
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new a6c3941  CAMEL-12782 - More specific error message for unresolved model classes.
(#2509)
a6c3941 is described below

commit a6c394118fad3819a98baf4142fb59f6db3735f0
Author: Bob Paulin <bob@bobpaulin.com>
AuthorDate: Sat Sep 8 02:54:11 2018 -0500

    CAMEL-12782 - More specific error message for unresolved model classes. (#2509)
    
    * CAMEL-12782 - More specific error message for unresolved model classes.
    
    * CAMEL-12782 - Make swagger model class resolution mandatory.
---
 .../src/main/java/org/apache/camel/swagger/RestSwaggerReader.java  | 7 ++++---
 .../java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java    | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
index cd3d58c..c0631b4 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
@@ -97,8 +97,9 @@ public class RestSwaggerReader {
      * @param config            the swagger configuration
      * @param classResolver     class resolver to use
      * @return the swagger model
+     * @throws ClassNotFoundException 
      */
-    public Swagger read(List<RestDefinition> rests, String route, BeanConfig config,
String camelContextId, ClassResolver classResolver) {
+    public Swagger read(List<RestDefinition> rests, String route, BeanConfig config,
String camelContextId, ClassResolver classResolver) throws ClassNotFoundException {
         Swagger swagger = new Swagger();
 
         for (RestDefinition rest : rests) {
@@ -118,7 +119,7 @@ public class RestSwaggerReader {
         return swagger;
     }
 
-    private void parse(Swagger swagger, RestDefinition rest, String camelContextId, ClassResolver
classResolver) {
+    private void parse(Swagger swagger, RestDefinition rest, String camelContextId, ClassResolver
classResolver) throws ClassNotFoundException {
         List<VerbDefinition> verbs = new ArrayList<>(rest.getVerbs());
         // must sort the verbs by uri so we group them together when an uri has multiple
operations
         Collections.sort(verbs, new VerbOrdering());
@@ -223,7 +224,7 @@ public class RestSwaggerReader {
 
         // use annotation scanner to find models (annotated classes)
         for (String type : types) {
-            Class<?> clazz = classResolver.resolveClass(type);
+            Class<?> clazz = classResolver.resolveMandatoryClass(type);
             appendModels(clazz, swagger);
         }
 
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
index e3276a0..6672215 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class RestSwaggerArrayEnumTest {
 
     @Test
-    public void shouldGenerateEnumValuesForArraysAndNonArrays() {
+    public void shouldGenerateEnumValuesForArraysAndNonArrays() throws Exception {
         final RestSwaggerReader reader = new RestSwaggerReader();
 
         final RestDefinition restDefinition = new RestDefinition();


Mime
View raw message