mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 08:31:26 +00:00
Added CodeGenStatus class with Status enum
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
import static io.swagger.codegen.languages.CodeGenStatus.Status.FAILED;
|
||||
import static io.swagger.codegen.languages.CodeGenStatus.Status.SUCCESSFUL;
|
||||
import static io.swagger.codegen.languages.CodeGenStatus.Status.UNRUN;
|
||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
|
||||
import io.swagger.codegen.languages.CodeGenStatus;
|
||||
import io.swagger.models.ComposedModel;
|
||||
import io.swagger.models.Contact;
|
||||
import io.swagger.models.Info;
|
||||
@@ -14,7 +20,6 @@ import io.swagger.models.Swagger;
|
||||
import io.swagger.models.auth.OAuth2Definition;
|
||||
import io.swagger.models.auth.SecuritySchemeDefinition;
|
||||
import io.swagger.util.Json;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -34,14 +39,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
protected CodegenConfig config;
|
||||
protected ClientOptInput opts = null;
|
||||
protected Swagger swagger = null;
|
||||
|
||||
public CodeGenStatus status = new CodeGenStatus(UNRUN);
|
||||
|
||||
public Generator opts(ClientOptInput opts) {
|
||||
this.opts = opts;
|
||||
|
||||
@@ -305,8 +309,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
|
||||
config.processSwagger(swagger);
|
||||
|
||||
status.setStatus(SUCCESSFUL);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
status.setStatus(FAILED);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
public class CodeGenStatus {
|
||||
public enum Status {
|
||||
UNRUN, SUCCESSFUL, FAILED
|
||||
};
|
||||
|
||||
private Status status;
|
||||
|
||||
public CodeGenStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user