Fix alias to map in the model's properties (#360)

* add test case for ref to map (boolean) in fake petstore spec

* fix alias to map in model properties

* remove logging from new method

* update samples for the new map test case

* fix javadoc string

* skip testSanitizeNestedInvalidValue in php test

* skip test in php oas3 client

* add logic to handle outer enum

* update samples

* fix alias in model's allOf

* generate models for map def

* update petstore samples

* update petstore samples
This commit is contained in:
William Cheng
2018-06-21 22:59:02 +08:00
committed by GitHub
parent 9509e66ae8
commit a897feef50
186 changed files with 6263 additions and 807 deletions

View File

@@ -6,6 +6,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional]
**directMap** | **Map<String, Boolean>** | | [optional]
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
<a name="Map<String, InnerEnum>"></a>

View File

@@ -0,0 +1,9 @@
# StringBooleanMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

View File

@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.StringBooleanMap;
/**
* MapTest
@@ -70,6 +71,12 @@ public class MapTest {
@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;
@JsonProperty("direct_map")
private Map<String, Boolean> directMap = null;
@JsonProperty("indirect_map")
private StringBooleanMap indirectMap = null;
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString;
return this;
@@ -122,6 +129,50 @@ public class MapTest {
this.mapOfEnumString = mapOfEnumString;
}
public MapTest directMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
return this;
}
public MapTest putDirectMapItem(String key, Boolean directMapItem) {
if (this.directMap == null) {
this.directMap = new HashMap<String, Boolean>();
}
this.directMap.put(key, directMapItem);
return this;
}
/**
* Get directMap
* @return directMap
**/
@ApiModelProperty(value = "")
public Map<String, Boolean> getDirectMap() {
return directMap;
}
public void setDirectMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
}
public MapTest indirectMap(StringBooleanMap indirectMap) {
this.indirectMap = indirectMap;
return this;
}
/**
* Get indirectMap
* @return indirectMap
**/
@ApiModelProperty(value = "")
public StringBooleanMap getIndirectMap() {
return indirectMap;
}
public void setIndirectMap(StringBooleanMap indirectMap) {
this.indirectMap = indirectMap;
}
@Override
public boolean equals(java.lang.Object o) {
@@ -133,12 +184,14 @@ public class MapTest {
}
MapTest mapTest = (MapTest) o;
return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) &&
Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString);
Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) &&
Objects.equals(this.directMap, mapTest.directMap) &&
Objects.equals(this.indirectMap, mapTest.indirectMap);
}
@Override
public int hashCode() {
return Objects.hash(mapMapOfString, mapOfEnumString);
return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap);
}
@@ -149,6 +202,8 @@ public class MapTest {
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n");
sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -82,7 +82,7 @@ public class OuterComposite {
* @return myBoolean
**/
@ApiModelProperty(value = "")
public Boolean getMyBoolean() {
public Boolean isMyBoolean() {
return myBoolean;
}

View File

@@ -0,0 +1,65 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}