I am trying to generate a spring boot project using the below yaml file on
CodePudding user response:
I guess you didnt C&P correctly.
I just setup a test project with your file and used openapi-generator-cli.jar With the command:
java -jar openapi-generator-cli.jar generate -i stack.yml -g spring -p java8=true
I created the project and the Error class is showing up:
package org.openapitools.model;
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 org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* Error
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2022-04-05T08:34:53.094779300 02:00[Europe/Berlin]")
public class Error {
@JsonProperty("id")
private String id;
@JsonProperty("message")
private String message;
public Error id(String id) {
this.id = id;
return this;
}
/**
* Unique id to represent a type of error
* @return id
*/
@ApiModelProperty(example = "bad_request", value = "Unique id to represent a type of error")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Error message(String message) {
this.message = message;
return this;
}
/**
* Meaningful message about what went wrong
* @return message
*/
@ApiModelProperty(example = "dealer id already exists", value = "Meaningful message about what went wrong")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Error error = (Error) o;
return Objects.equals(this.id, error.id) &&
Objects.equals(this.message, error.message);
}
@Override
public int hashCode() {
return Objects.hash(id, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Error {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).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 ");
}
}