Avoid using import mapping in model generation (#11217)

* remove import mapping logic in model generation, better handle of file, list

* add new files for file, list

* fix some tests

* update tests, doc

* skip file as reserved word in feign client

* add new files

* remove file from reserved word list in spring generator
This commit is contained in:
William Cheng
2022-01-16 23:57:53 +08:00
committed by GitHub
parent 3f4e7d8263
commit 33bce99b8e
382 changed files with 7655 additions and 1348 deletions

View File

@@ -549,7 +549,7 @@ if (status != null)
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @param _file file to upload (optional)
* @return ModelApiResponse
* @throws ApiException if fails to make API call
* @http.response.details
@@ -558,8 +558,8 @@ if (status != null)
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
</table>
*/
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData();
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _file) throws ApiException {
return uploadFileWithHttpInfo(petId, additionalMetadata, _file).getData();
}
/**
@@ -567,7 +567,7 @@ if (status != null)
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @param _file file to upload (optional)
* @return ApiResponse&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
@@ -576,7 +576,7 @@ if (status != null)
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
</table>
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File _file) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
@@ -599,8 +599,8 @@ if (status != null)
if (additionalMetadata != null)
localVarFormParams.put("additionalMetadata", additionalMetadata);
if (file != null)
localVarFormParams.put("file", file);
if (_file != null)
localVarFormParams.put("file", _file);
final String[] localVarAccepts = {
"application/json"

View File

@@ -26,6 +26,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ModelFile;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
@@ -40,46 +41,46 @@ import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class FileSchemaTestClass {
public static final String JSON_PROPERTY_FILE = "file";
private java.io.File file;
private ModelFile _file;
public static final String JSON_PROPERTY_FILES = "files";
private List<java.io.File> files = null;
private List<ModelFile> files = null;
public FileSchemaTestClass() {
}
public FileSchemaTestClass file(java.io.File file) {
this.file = file;
public FileSchemaTestClass _file(ModelFile _file) {
this._file = _file;
return this;
}
/**
* Get file
* @return file
* Get _file
* @return _file
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_FILE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public java.io.File getFile() {
return file;
public ModelFile getFile() {
return _file;
}
@JsonProperty(JSON_PROPERTY_FILE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFile(java.io.File file) {
this.file = file;
public void setFile(ModelFile _file) {
this._file = _file;
}
public FileSchemaTestClass files(List<java.io.File> files) {
public FileSchemaTestClass files(List<ModelFile> files) {
this.files = files;
return this;
}
public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
public FileSchemaTestClass addFilesItem(ModelFile filesItem) {
if (this.files == null) {
this.files = new ArrayList<>();
}
@@ -96,14 +97,14 @@ public class FileSchemaTestClass {
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<java.io.File> getFiles() {
public List<ModelFile> getFiles() {
return files;
}
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFiles(List<java.io.File> files) {
public void setFiles(List<ModelFile> files) {
this.files = files;
}
@@ -120,20 +121,20 @@ public class FileSchemaTestClass {
return false;
}
FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o;
return Objects.equals(this.file, fileSchemaTestClass.file) &&
return Objects.equals(this._file, fileSchemaTestClass._file) &&
Objects.equals(this.files, fileSchemaTestClass.files);
}
@Override
public int hashCode() {
return Objects.hash(file, files);
return Objects.hash(_file, files);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FileSchemaTestClass {\n");
sb.append(" file: ").append(toIndentedString(file)).append("\n");
sb.append(" _file: ").append(toIndentedString(_file)).append("\n");
sb.append(" files: ").append(toIndentedString(files)).append("\n");
sb.append("}");
return sb.toString();