forked from openrtb/openrtb2x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ValidationResult to remove external dependency; updated license…
… text; added examples
- Loading branch information
1 parent
7e898b7
commit da1454b
Showing
22 changed files
with
603 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,30 @@ | ||
openrtb-validator | ||
================= | ||
# openrtb-validator | ||
|
||
This project provides a simple API that can be used to validate JSON bid requests and responses according to OpenRTB specifications. OpenRTB versions 1.0, 2.0, 2.1, 2.2, and 2.3 are fully supported. | ||
|
||
Provided under the New BSD License. Refer to the file LICENSE file in the root of this project for more information. | ||
|
||
Usage | ||
----- | ||
## Usage | ||
|
||
To add validator dependencies to a Maven pom.xml: | ||
Add the OpenRTB-validator dependency to your Maven pom.xml: | ||
|
||
<dependency> | ||
<groupId>org.openrtb</groupId> | ||
<artifactId>openrtb-validator</artifactId> | ||
<version>2.2.0</version> | ||
<version>2.3.1</version> | ||
<type>jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.fge</groupId> | ||
<artifactId>json-schema-validator</artifactId> | ||
<version>2.1.3</version> | ||
</dependency> | ||
|
||
To ascertain whether a given JSON String, File, Reader, or Resource is a valid bid request according to OpenRTB v2.2 specifications: | ||
To ascertain whether a given JSON String, File, Reader, or Resource is a valid bid request according to OpenRTB v2.3 specifications: | ||
|
||
OpenRtbValidator validator = OpenRtbValidatorFactory.getValidator(OpenRtbInputType.BID_REQUEST, OpenRtbVersion.V2_2); | ||
OpenRtbValidator validator = OpenRtbValidatorFactory.getValidator(OpenRtbInputType.BID_REQUEST, OpenRtbVersion.V2_3); | ||
boolean valid = validator.isValid(json); | ||
|
||
To get a detailed validation report including reasons why the JSON is invalid: | ||
|
||
ProcessingReport report = validator.validate(json); | ||
System.out.println("validation report: " + report); | ||
ValidationResult validationResult = validator.validate(json); | ||
System.out.println("valid: " + validationResult.isValid() + ", result: " + validationResult.getResult()); | ||
|
||
Specification Documents | ||
----------------------- | ||
## Specification Documents | ||
|
||
The specification documents used to create these OpenRTB validation schemas can be found under src/main/resources/specification. | ||
The specification documents used to create these OpenRTB validation schemas can be found under src/main/resources/specification and at http://www.iab.net/guidelines/rtbproject. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,100 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.openrtb</groupId> | ||
<artifactId>openrtb-validator</artifactId> | ||
<version>2.3.0</version> | ||
<packaging>jar</packaging> | ||
<groupId>org.openrtb</groupId> | ||
<artifactId>openrtb-validator</artifactId> | ||
<version>2.3.1</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>openrtb-validator</name> | ||
<url>http://maven.apache.org</url> | ||
<name>openrtb-validator</name> | ||
<url>http://maven.apache.org</url> | ||
<description>Provides a simple API that can be used to validate JSON bid requests and responses according to OpenRTB specifications. OpenRTB versions 1.0, 2.0, 2.1, 2.2, and 2.3 are fully supported.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<component.name>openrtb-validator</component.name> | ||
</properties> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<component.name>openrtb-validator</component.name> | ||
</properties> | ||
|
||
<licenses> | ||
<license> | ||
<name>New BSD License</name> | ||
<url>http://opensource.org/licenses/BSD-3-Clause</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>1.7.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.fge</groupId> | ||
<artifactId>json-schema-validator</artifactId> | ||
<version>2.1.3</version> | ||
</dependency> | ||
</dependencies> | ||
<licenses> | ||
<license> | ||
<name>New BSD License</name> | ||
<url>http://opensource.org/licenses/BSD-3-Clause</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<name>Nick Whalen</name> | ||
<email>[email protected]</email> | ||
<organization>OpenRTB</organization> | ||
<organizationUrl>https://github.com/openrtb/openrtb2x</organizationUrl> | ||
</developer> | ||
</developers> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>1.7.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.fge</groupId> | ||
<artifactId>json-schema-validator</artifactId> | ||
<version>2.2.6</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<excludes> | ||
<exclude>specifications/</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.9</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> | ||
</repository> | ||
</distributionManagement> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<excludes> | ||
<exclude>specifications/</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.9</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<scm> | ||
<url>https://github.com/openrtb/openrtb2x/tree/2.0/openrtb-validator</url> | ||
<connection>scm:git:https://github.com/openrtb/openrtb2x.git</connection> | ||
<developerConnection>scm:git:[email protected]:openrtb/openrtb2x.git</developerConnection> | ||
</scm> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.