forked from loafle/openapi-generator-original
Merge pull request #1471 from wing328/invalid_array_type
Better error handling for invalid array/map type
This commit is contained in:
commit
1b538f6eaf
@ -814,6 +814,7 @@ public class DefaultCodegen {
|
||||
LOGGER.error("unexpected missing property for name " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
|
||||
|
||||
property.name = toVarName(name);
|
||||
@ -1907,6 +1908,12 @@ public class DefaultCodegen {
|
||||
// character with _ or empty character. Below aims to spell out different cases we've
|
||||
// encountered so far and hopefully make it easier for others to add more special
|
||||
// cases in the future.
|
||||
|
||||
// better error handling when map/array type is invalid
|
||||
if (name == null) {
|
||||
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
|
||||
return "ERROR_UNKNOWN";
|
||||
}
|
||||
|
||||
// input[] => input
|
||||
name = name.replaceAll("\\[\\]", "");
|
||||
|
@ -6,11 +6,7 @@
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-java-client</name>
|
||||
<version>1.0.0</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
</scm>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class ApiException extends Exception {
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Configuration {
|
||||
private static ApiClient defaultApiClient = new ApiClient();
|
||||
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.datatype.joda.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-21T11:55:29.717+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class JSON {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class TypeRef<T> {
|
||||
private final Type type;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import java.io.File;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-21T11:55:29.717+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class PetApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import io.swagger.client.model.Order;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-21T11:55:29.717+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class StoreApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import java.util.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-21T11:55:29.717+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class UserApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public interface Authentication {
|
||||
/** Apply authentication settings to header and query params. */
|
||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T10:56:59.550-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -100,6 +100,10 @@
|
||||
float: left;
|
||||
}
|
||||
|
||||
.param-enum {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
border-bottom: 2px;
|
||||
font-weight: bold;
|
||||
|
@ -3,13 +3,15 @@
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">id : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">name : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -3,37 +3,55 @@
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">id : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">petId : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">quantity : Integer
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">shipDate : Date
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">status : String
|
||||
<br/>Order Status
|
||||
<br/>Order Status
|
||||
|
||||
<dl class="param-enum">
|
||||
<dt>Enum:
|
||||
|
||||
<dd>placed</dd>
|
||||
|
||||
<dd>approved</dd>
|
||||
|
||||
<dd>delivered</dd>
|
||||
|
||||
</dt>
|
||||
</dl>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">complete : Boolean
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -3,37 +3,55 @@
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">id : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">category : Category
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-true">name : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-true">photoUrls : List
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">tags : List
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">status : String
|
||||
<br/>pet status in the store
|
||||
<br/>pet status in the store
|
||||
|
||||
<dl class="param-enum">
|
||||
<dt>Enum:
|
||||
|
||||
<dd>available</dd>
|
||||
|
||||
<dd>pending</dd>
|
||||
|
||||
<dd>sold</dd>
|
||||
|
||||
</dt>
|
||||
</dl>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -3,13 +3,15 @@
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">id : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">name : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -3,49 +3,57 @@
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">id : Long
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">username : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">firstName : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">lastName : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">email : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">password : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">phone : String
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="parameter">
|
||||
<li class="param-required-">userStatus : Integer
|
||||
<br/>User Status
|
||||
<br/>User Status
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user