forked from loafle/openapi-generator-original
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:
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.Valid;
|
||||
@@ -20,13 +21,13 @@ import java.util.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class FileSchemaTestClass {
|
||||
@JsonProperty("file")
|
||||
private java.io.File file;
|
||||
private File file;
|
||||
|
||||
@JsonProperty("files")
|
||||
@Valid
|
||||
private List<java.io.File> files = null;
|
||||
private List<File> files = null;
|
||||
|
||||
public FileSchemaTestClass file(java.io.File file) {
|
||||
public FileSchemaTestClass file(File file) {
|
||||
this.file = file;
|
||||
return this;
|
||||
}
|
||||
@@ -39,22 +40,22 @@ public class FileSchemaTestClass {
|
||||
|
||||
@Valid
|
||||
|
||||
public java.io.File getFile() {
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(java.io.File file) {
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public FileSchemaTestClass files(List<java.io.File> files) {
|
||||
public FileSchemaTestClass files(List<File> files) {
|
||||
this.files = files;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
|
||||
public FileSchemaTestClass addFilesItem(File filesItem) {
|
||||
if (this.files == null) {
|
||||
this.files = new ArrayList<java.io.File>();
|
||||
this.files = new ArrayList<File>();
|
||||
}
|
||||
this.files.add(filesItem);
|
||||
return this;
|
||||
@@ -68,11 +69,11 @@ public class FileSchemaTestClass {
|
||||
|
||||
@Valid
|
||||
|
||||
public List<java.io.File> getFiles() {
|
||||
public List<File> getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
public void setFiles(List<java.io.File> files) {
|
||||
public void setFiles(List<File> files) {
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Must be named `File` for test.
|
||||
*/
|
||||
@ApiModel(description = "Must be named `File` for test.")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class ModelFile {
|
||||
@JsonProperty("sourceURI")
|
||||
private String sourceURI;
|
||||
|
||||
public ModelFile sourceURI(String sourceURI) {
|
||||
this.sourceURI = sourceURI;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test capitalization
|
||||
* @return sourceURI
|
||||
*/
|
||||
@ApiModelProperty(value = "Test capitalization")
|
||||
|
||||
|
||||
public String getSourceURI() {
|
||||
return sourceURI;
|
||||
}
|
||||
|
||||
public void setSourceURI(String sourceURI) {
|
||||
this.sourceURI = sourceURI;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ModelFile _file = (ModelFile) o;
|
||||
return Objects.equals(this.sourceURI, _file.sourceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sourceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelFile {\n");
|
||||
|
||||
sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ModelList
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class ModelList {
|
||||
@JsonProperty("123-list")
|
||||
private String _123list;
|
||||
|
||||
public ModelList _123list(String _123list) {
|
||||
this._123list = _123list;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123list
|
||||
* @return _123list
|
||||
*/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
|
||||
public String get123list() {
|
||||
return _123list;
|
||||
}
|
||||
|
||||
public void set123list(String _123list) {
|
||||
this._123list = _123list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ModelList _list = (ModelList) o;
|
||||
return Objects.equals(this._123list, _list._123list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(_123list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelList {\n");
|
||||
|
||||
sb.append(" _123list: ").append(toIndentedString(_123list)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user