Skip to content

Commit

Permalink
Merge pull request #183 from RepreZen/task/180
Browse files Browse the repository at this point in the history
[#180] Incorporate position information into validation items
  • Loading branch information
andylowry authored Aug 20, 2018
2 parents 8b341a2 + 4dad851 commit bac63f2
Show file tree
Hide file tree
Showing 87 changed files with 3,066 additions and 2,791 deletions.
23 changes: 17 additions & 6 deletions kaizen-openapi-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
Expand All @@ -82,10 +77,20 @@
<artifactId>javax.mail-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.reprezen.jsonoverlay</groupId>
<artifactId>jsonoverlay</artifactId>
<version>${json-overlay-version}</version>
<version>[3.0,4.0)</version>
</dependency>
</dependencies>
<profiles>
Expand Down Expand Up @@ -235,4 +240,10 @@
<nexus.autodrop>true</nexus.autodrop>
<jackson-version>2.6.2</jackson-version>
</properties>
<repositories>
<repository>
<id>jovl-staging</id>
<url>https://oss.sonatype.org/content/repositories/comreprezenjsonoverlay-1033/</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,9 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
import com.reprezen.kaizen.oasparser.val3.ValidationConfigurator;

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);
Expand Down Expand Up @@ -80,7 +71,8 @@ public OpenApi3 parse(JsonNode tree, URL resolutionBase, boolean validate) {

@Override
protected boolean isVersion3(JsonNode tree) {
return true; // if 'openapi' property is missing or incorrect, that will show up as a
// validation error
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 @@ -17,27 +17,13 @@
import java.net.URL;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.reprezen.jsonoverlay.JsonLoader;
import com.reprezen.jsonoverlay.ReferenceManager;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
import com.reprezen.kaizen.oasparser.ovl3.OpenApi3Impl;
import com.reprezen.kaizen.oasparser.val3.ValidationConfigurator;
import com.reprezen.kaizen.oasparser.val3.ovl.OverlayValidationConfigurator;

public class OpenApiParser {

private Injector injector;

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

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

public OpenApi<?> parse(String spec, URL resolutionBase) {
return parse(spec, resolutionBase, true);
}
Expand Down Expand Up @@ -101,7 +87,6 @@ private OpenApi<?> parse(ReferenceManager manager, boolean validate) {
if (isVersion3(tree)) {
OpenApi3 model = (OpenApi3) OpenApi3Impl.factory.create(tree, null, manager);
((OpenApi3Impl) model)._setCreatingRef(manager.getDocReference());
injector.injectMembers(model);
if (validate) {
model.validate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_callbackPaths = "callbackPaths";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_name = "name";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_url = "url";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_email = "email";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,21 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_contentType = "contentType";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_headers = "headers";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_style = "style";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_explode = "explode";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_summary = "summary";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_description = "description";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_value = "value";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_externalValue = "externalValue";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_description = "description";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_url = "url";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,48 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_name = "name";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_in = "in";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_description = "description";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_required = "required";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_deprecated = "deprecated";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_allowEmptyValue = "allowEmptyValue";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_style = "style";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_explode = "explode";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_allowReserved = "allowReserved";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_schema = "schema";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_example = "example";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_examples = "examples";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_contentMediaTypes = "contentMediaTypes";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_title = "title";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_description = "description";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_termsOfService = "termsOfService";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_contact = "contact";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_license = "license";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_version = "version";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_name = "name";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_url = "url";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,27 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_operationId = "operationId";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_operationRef = "operationRef";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_parameters = "parameters";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_headers = "headers";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_description = "description";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_server = "server";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_schema = "schema";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_examples = "examples";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_example = "example";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_encodingProperties = "encodingProperties";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,24 @@ public void removeExtension(String name) {
_remove("extensions", name, Object.class);
}

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_authorizationUrl = "authorizationUrl";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_tokenUrl = "tokenUrl";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_refreshUrl = "refreshUrl";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_scopes = "scopes";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_scopesExtensions = "scopesExtensions";

@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
public static final String F_extensions = "extensions";

@Override
@Generated("com.reprezen.jsonoverlay.gen.CodeGenerator")
protected void _elaborateJson() {
Expand Down
Loading

0 comments on commit bac63f2

Please sign in to comment.