Skip to content

Commit

Permalink
[#180] Reformat all sources
Browse files Browse the repository at this point in the history
Upgraded to Photo eclipse installation, default formatting changed. No
actual source changes here, just reformatted all source files to avoid
confusing future diffs
  • Loading branch information
andylowry committed Aug 12, 2018
1 parent 6a45dce commit 0bc6658
Show file tree
Hide file tree
Showing 107 changed files with 11,662 additions and 11,648 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
import com.reprezen.jsonoverlay.gen.CodeGenerator;

public class GenOpenApi3 {
public static void main(String[] args) throws Exception {
CodeGenerator.main(new String[] { //
"-t", "src/main/java/com/reprezen/kaizen/oasparser/types3.yaml", //
"-p", "com.reprezen.kaizen.oasparser", //
"-d", "src/main/java/com/reprezen/kaizen/oasparser", //
"-i", "model3", //
"-I", "model3", //
"-c", "ovl3", //
"-C", "ovl3", //
// , "-n" // uncomment to run in no-preserve mode
});
}
public static void main(String[] args) throws Exception {
CodeGenerator.main(new String[] { //
"-t", "src/main/java/com/reprezen/kaizen/oasparser/types3.yaml", //
"-p", "com.reprezen.kaizen.oasparser", //
"-d", "src/main/java/com/reprezen/kaizen/oasparser", //
"-i", "model3", //
"-I", "model3", //
"-c", "ovl3", //
"-C", "ovl3", //
// , "-n" // uncomment to run in no-preserve mode
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,67 +20,68 @@

public class OpenApi3Parser extends OpenApiParser {

public OpenApi3Parser() {
super();
}

public OpenApi3Parser(ValidationConfigurator validationConfigurator) {
super(validationConfigurator);
}

@Override
public OpenApi3 parse(String spec, URL resolutionBase) {
return (OpenApi3) super.parse(spec, resolutionBase);
}

@Override
public OpenApi3 parse(String spec, URL resolutionBase, boolean validate) {
return (OpenApi3) super.parse(spec, resolutionBase, validate);
}

@Override
public OpenApi3 parse(File specFile) throws Exception {
return (OpenApi3) super.parse(specFile);
}

@Override
public OpenApi3 parse(File specFile, boolean validate) throws Exception {
return (OpenApi3) super.parse(specFile, validate);
}

@Override
public OpenApi3 parse(URI uri) throws Exception {
return (OpenApi3) super.parse(uri);
}

@Override
public OpenApi3 parse(URI uri, boolean validate) throws Exception {
return (OpenApi3) super.parse(uri, validate);
}

@Override
public OpenApi3 parse(URL resolutionBase) throws Exception {
return (OpenApi3) super.parse(resolutionBase);
}

@Override
public OpenApi3 parse(URL resolutionBase, boolean validate) throws Exception {
return (OpenApi3) super.parse(resolutionBase, validate);
}

@Override
public OpenApi3 parse(JsonNode tree, URL resolutionBase) {
return (OpenApi3) super.parse(tree, resolutionBase);
}

@Override
public OpenApi3 parse(JsonNode tree, URL resolutionBase, boolean validate) {
return (OpenApi3) super.parse(tree, resolutionBase, validate);
}

@Override
protected boolean isVersion3(JsonNode tree) {
return true; // if 'openapi' property is missing or incorrect, that will show up as a
// validation error
}
public OpenApi3Parser() {
super();
}

public OpenApi3Parser(ValidationConfigurator validationConfigurator) {
super(validationConfigurator);
}

@Override
public OpenApi3 parse(String spec, URL resolutionBase) {
return (OpenApi3) super.parse(spec, resolutionBase);
}

@Override
public OpenApi3 parse(String spec, URL resolutionBase, boolean validate) {
return (OpenApi3) super.parse(spec, resolutionBase, validate);
}

@Override
public OpenApi3 parse(File specFile) throws Exception {
return (OpenApi3) super.parse(specFile);
}

@Override
public OpenApi3 parse(File specFile, boolean validate) throws Exception {
return (OpenApi3) super.parse(specFile, validate);
}

@Override
public OpenApi3 parse(URI uri) throws Exception {
return (OpenApi3) super.parse(uri);
}

@Override
public OpenApi3 parse(URI uri, boolean validate) throws Exception {
return (OpenApi3) super.parse(uri, validate);
}

@Override
public OpenApi3 parse(URL resolutionBase) throws Exception {
return (OpenApi3) super.parse(resolutionBase);
}

@Override
public OpenApi3 parse(URL resolutionBase, boolean validate) throws Exception {
return (OpenApi3) super.parse(resolutionBase, validate);
}

@Override
public OpenApi3 parse(JsonNode tree, URL resolutionBase) {
return (OpenApi3) super.parse(tree, resolutionBase);
}

@Override
public OpenApi3 parse(JsonNode tree, URL resolutionBase, boolean validate) {
return (OpenApi3) super.parse(tree, resolutionBase, validate);
}

@Override
protected boolean isVersion3(JsonNode tree) {
return true; // if 'openapi' property is missing or incorrect, that will
// show up as a
// validation error
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,121 +28,121 @@

public class OpenApiParser {

private Injector injector;
private Injector injector;

public OpenApiParser() {
this(new OverlayValidationConfigurator());
}
public OpenApiParser() {
this(new OverlayValidationConfigurator());
}

public OpenApiParser(ValidationConfigurator validationConfigurator) {
this.injector = Guice.createInjector(validationConfigurator);
}
public OpenApiParser(ValidationConfigurator validationConfigurator) {
this.injector = Guice.createInjector(validationConfigurator);
}

public OpenApi<?> parse(String spec, URL resolutionBase) {
return parse(spec, resolutionBase, true);
}
public OpenApi<?> parse(String spec, URL resolutionBase) {
return parse(spec, resolutionBase, true);
}

public OpenApi<?> parse(String spec, URL resolutionBase, boolean validate) {
try {
JsonNode tree = new JsonLoader().loadString(resolutionBase, spec);
return parse(tree, resolutionBase, validate);
public OpenApi<?> parse(String spec, URL resolutionBase, boolean validate) {
try {
JsonNode tree = new JsonLoader().loadString(resolutionBase, spec);
return parse(tree, resolutionBase, validate);

} catch (IOException e) {
throw new OpenApiParserException("Failed to parse spec as JSON or YAML", e);
}
} catch (IOException e) {
throw new OpenApiParserException("Failed to parse spec as JSON or YAML", e);
}
}

public OpenApi<?> parse(File specFile) throws Exception {
return parse(specFile, true);
}
public OpenApi<?> parse(File specFile) throws Exception {
return parse(specFile, true);
}

public OpenApi<?> parse(File specFile, boolean validate) throws Exception {
try {
return parse(specFile.toURI().toURL(), validate);
} catch (IOException e) {
throw new OpenApiParserException("Failed to read spec from file", e);
}
public OpenApi<?> parse(File specFile, boolean validate) throws Exception {
try {
return parse(specFile.toURI().toURL(), validate);
} catch (IOException e) {
throw new OpenApiParserException("Failed to read spec from file", e);
}
}

public OpenApi<?> parse(URI uri) throws Exception {
return parse(uri, true);
}
public OpenApi<?> parse(URI uri) throws Exception {
return parse(uri, true);
}

public OpenApi<?> parse(URI uri, boolean validate) throws Exception {
try {
return parse(uri.toURL(), validate);
} catch (MalformedURLException e) {
throw new OpenApiParserException("Invalid URI for Swagger spec", e);
public OpenApi<?> parse(URI uri, boolean validate) throws Exception {
try {
return parse(uri.toURL(), validate);
} catch (MalformedURLException e) {
throw new OpenApiParserException("Invalid URI for Swagger spec", e);
}
}

public OpenApi<?> parse(URL resolutionBase) throws Exception {
return parse(resolutionBase, true);
}

public OpenApi<?> parse(URL resolutionBase, boolean validate) throws Exception {
ReferenceManager manager = new ReferenceManager(resolutionBase);
return parse(manager, validate);
}

public OpenApi<?> parse(JsonNode tree, URL resolutionBase) {
return parse(tree, resolutionBase, true);
}

public OpenApi<?> parse(JsonNode tree, URL resolutionBase, boolean validate) {
ReferenceManager manager = new ReferenceManager(resolutionBase, tree);
return parse(manager, validate);
}

private OpenApi<?> parse(ReferenceManager manager, boolean validate) {
JsonNode tree;
try {
tree = manager.loadDoc();
if (isVersion3(tree)) {
OpenApi3 model = (OpenApi3) OpenApi3Impl.factory.create(tree, null, manager);
((OpenApi3Impl) model)._setCreatingRef(manager.getDocReference());
injector.injectMembers(model);
if (validate) {
model.validate();
}
return model;
} else {
throw new OpenApiParserException(
"Could not determine OpenApi version from model: no 'openapi' property");
}
} catch (IOException e) {
throw new OpenApiParserException("Failed to parse model", e);
}
}

public OpenApi<?> parse(URL resolutionBase) throws Exception {
return parse(resolutionBase, true);
}
protected boolean isVersion3(JsonNode tree) {
JsonNode versionNode = tree.path("openapi");
return versionNode.isTextual() && versionNode.asText().startsWith("3.");
}

public OpenApi<?> parse(URL resolutionBase, boolean validate) throws Exception {
ReferenceManager manager = new ReferenceManager(resolutionBase);
return parse(manager, validate);
}
public static class OpenApiParserException extends RuntimeException {

public OpenApi<?> parse(JsonNode tree, URL resolutionBase) {
return parse(tree, resolutionBase, true);
}
private static final long serialVersionUID = 1L;

public OpenApi<?> parse(JsonNode tree, URL resolutionBase, boolean validate) {
ReferenceManager manager = new ReferenceManager(resolutionBase, tree);
return parse(manager, validate);
public OpenApiParserException() {
super();
}

private OpenApi<?> parse(ReferenceManager manager, boolean validate) {
JsonNode tree;
try {
tree = manager.loadDoc();
if (isVersion3(tree)) {
OpenApi3 model = (OpenApi3) OpenApi3Impl.factory.create(tree, null, manager);
((OpenApi3Impl) model)._setCreatingRef(manager.getDocReference());
injector.injectMembers(model);
if (validate) {
model.validate();
}
return model;
} else {
throw new OpenApiParserException(
"Could not determine OpenApi version from model: no 'openapi' property");
}
} catch (IOException e) {
throw new OpenApiParserException("Failed to parse model", e);
}
public OpenApiParserException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

protected boolean isVersion3(JsonNode tree) {
JsonNode versionNode = tree.path("openapi");
return versionNode.isTextual() && versionNode.asText().startsWith("3.");
public OpenApiParserException(String message, Throwable cause) {
super(message, cause);
}

public static class OpenApiParserException extends RuntimeException {

private static final long serialVersionUID = 1L;

public OpenApiParserException() {
super();
}

public OpenApiParserException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

public OpenApiParserException(String message, Throwable cause) {
super(message, cause);
}

public OpenApiParserException(String message) {
super(message);
}
public OpenApiParserException(String message) {
super(message);
}

public OpenApiParserException(Throwable cause) {
super(cause);
}
public OpenApiParserException(Throwable cause) {
super(cause);
}
}
}
Loading

0 comments on commit 0bc6658

Please sign in to comment.