Skip to content

Commit 95b1df8

Browse files
authored
Merge branch 'master' into feature/update-deps
2 parents f8fb1d6 + 4e75df4 commit 95b1df8

28 files changed

+582
-424
lines changed

README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
[![License LGPLv3][LGPLv3 badge]][LGPLv3]
2+
[![License ASL 2.0][ASL 2.0 badge]][ASL 2.0]
3+
[![Build Status][Travis badge]][Travis]
4+
![Maven Central](https://img.shields.io/maven-central/v/com.github.fge/json-schema-validator.svg)
5+
16
## Travis builds now enabled
27

3-
Builds are now verified by Travis (see [issue #20](https://github.com/daveclayton/json-patch/issues/20) from the json-patch project for details)
8+
Builds are now verified by Travis (see [issue #20](https://github.com/java-json-tools/json-patch/issues/20) from the json-patch project for details)
49

5-
https://travis-ci.org/daveclayton/json-schema-validator
10+
https://travis-ci.org/java-json-tools/json-schema-validator
611

712
## Read me first
813

9-
The **current** version of this project is licensed under both LGPLv3 (or later) and ASL 2.0. The old version
10-
(2.0.x) was licensed under LGPL 3.0 (or later) only.
14+
The **current** version of this project is licensed under both [LGPLv3] (or later) and [ASL 2.0]. The old version
15+
(2.0.x) was licensed under [LGPL 3.0][LGPLv3] (or later) only.
1116

12-
**Version 2.2 is out**. See [here](https://github.com/daveclayton/json-schema-validator/wiki/Whatsnew_22)
17+
**Version 2.2 is out**. See [here](https://github.com/java-json-tools/json-schema-validator/wiki/Whatsnew_22)
1318
for the list of changes compared to 2.0. And of course, it still has [all the
1419
features](https://github.com/daveclayton/json-schema-validator/wiki/Features) of older versions.
1520

@@ -34,19 +39,19 @@ timely manner.
3439
## Testing online
3540

3641
You can [test this library online](http://json-schema-validator.herokuapp.com); this web site is in
37-
a [project of its own](https://github.com/daveclayton/json-schema-validator-demo), which you can fork and
42+
a [project of its own](https://github.com/java-json-tools/json-schema-validator-demo), which you can fork and
3843
run by yourself.
3944

4045
## Versions
4146

4247
* current stable version: **2.2.6**
43-
([ChangeLog](https://github.com/daveclayton/json-schema-validator/wiki/ChangeLog_22x),
44-
[Javadoc](http://daveclayton.github.io/json-schema-validator/2.2.x/index.html), [code
45-
samples](http://daveclayton.github.io/json-schema-validator/2.2.x/index.html?com/github/fge/jsonschema/examples/package-summary.html)).
48+
([ChangeLog](https://github.com/java-json-tools/json-schema-validator/wiki/ChangeLog_22x),
49+
[Javadoc](http://java-json-tools.github.io/json-schema-validator/2.2.x/index.html), [code
50+
samples](http://java-json-tools.github.io/json-schema-validator/2.2.x/index.html?com/github/fge/jsonschema/examples/package-summary.html)).
4651
* old stable version: **2.0.4**
47-
([ChangeLog](https://github.com/daveclayton/json-schema-validator/wiki/ChangeLog_20x),
48-
[Javadoc](http://daveclayton.github.io/json-schema-validator/2.0.x/index.html), [code
49-
samples](http://daveclayton.github.io/json-schema-validator/2.0.x/index.html?com/github/fge/jsonschema/examples/package-summary.html)).
52+
([ChangeLog](https://github.com/java-json-tools/json-schema-validator/wiki/ChangeLog_20x),
53+
[Javadoc](http://java-json-tools.github.io/json-schema-validator/2.0.x/index.html), [code
54+
samples](http://java-json-tools.github.io/json-schema-validator/2.0.x/index.html?com/github/fge/jsonschema/examples/package-summary.html)).
5055

5156
## Available downloads
5257

@@ -100,8 +105,14 @@ This implementation is based on the following drafts:
100105
## More...
101106

102107
For a detailed discussion of the implementation, see
103-
[here](https://github.com/daveclayton/json-schema-validator/wiki/Status).
108+
[here](https://github.com/java-json-tools/json-schema-validator/wiki/Status).
104109

105-
Please see the [wiki](https://github.com/daveclayton/json-schema-validator/wiki/) for more
110+
Please see the [wiki](https://github.com/java-json-tools/json-schema-validator/wiki/) for more
106111
details.
107112

113+
[LGPLv3 badge]: https://img.shields.io/:license-LGPLv3-blue.svg
114+
[LGPLv3]: http://www.gnu.org/licenses/lgpl-3.0.html
115+
[ASL 2.0 badge]: https://img.shields.io/:license-Apache%202.0-blue.svg
116+
[ASL 2.0]: http://www.apache.org/licenses/LICENSE-2.0.html
117+
[Travis Badge]: https://api.travis-ci.org/daveclayton/json-schema-validator.svg?branch=master
118+
[Travis]: https://travis-ci.org/daveclayton/json-schema-validator

build.gradle

Lines changed: 40 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,18 @@
1717
* - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
1818
*/
1919

20-
/*
21-
* This has to be here... It will not be taken into account in common.gradle!
22-
*
23-
* Looks like a serious bug... See also:
24-
*
25-
* http://forums.gradle.org/gradle/topics/buildscript_in_subprojects_ignored
26-
*/
27-
/*
28-
* This has to be here... It will not be taken into account in common.gradle!
29-
*
30-
* Looks like a serious bug... See also:
31-
*
32-
* http://forums.gradle.org/gradle/topics/buildscript_in_subprojects_ignored
33-
*
34-
* We also use Spring's propdeps plugin to have a _real_ provided scope. See:
35-
*
36-
* https://github.com/spring-projects/gradle-plugins/tree/master/propdeps-plugin
37-
*/
38-
3920
apply(plugin: "java");
4021
apply(plugin: "maven");
4122
apply(plugin: "signing");
4223
apply(plugin: "osgi");
4324
apply(plugin: "idea");
4425
apply(plugin: "eclipse");
4526

46-
group = "com.github.fge";
47-
version = "2.2.6";
27+
group = "com.github.java-json-tools";
28+
version = "2.2.7";
4829
sourceCompatibility = "1.6";
4930
targetCompatibility = "1.6"; // defaults to sourceCompatibility
5031

51-
project.ext {
52-
description = "A Java implementation of the JSON Schema specification";
53-
};
54-
5532
/*
5633
* Repositories to use
5734
*/
@@ -63,7 +40,7 @@ repositories {
6340
* List of dependencies
6441
*/
6542
dependencies {
66-
compile(group: "com.github.fge", name: "json-schema-core", version: "1.2.5");
43+
compile(group: "com.github.java-json-tools", name: "json-schema-core", version: "1.2.8");
6744
compile(group: "javax.mail", name: "mailapi", version: "1.4.3");
6845
compile(group: "joda-time", name: "joda-time", version: "2.9.7");
6946
compile(group: "com.googlecode.libphonenumber", name: "libphonenumber", version: "8.0.0");
@@ -87,7 +64,7 @@ javadoc.options.links("http://fge.github.io/btf/");
8764
javadoc.options.links("http://fge.github.io/msg-simple/");
8865
javadoc.options.links("http://fge.github.io/jackson-coreutils/");
8966
javadoc.options.links("http://fge.github.io/uri-template/");
90-
javadoc.options.links("http://fge.github.io/json-schema-core/1.2.x/");
67+
javadoc.options.links("http://java-json-tools.github.io/json-schema-core/1.2.x/");
9168

9269

9370
/*
@@ -125,12 +102,14 @@ javadoc.options {
125102
* Equally annoyingly, the docFilesSubDirs option above does not seem to have
126103
* any effect :/
127104
*/
128-
task copyDocFiles(dependsOn: javadoc) << {
129-
copy {
130-
from("src/main/javadoc") {
131-
include "**/doc-files/**";
132-
};
133-
into javadoc.destinationDir;
105+
task copyDocFiles(dependsOn: javadoc) {
106+
doLast {
107+
copy {
108+
from("src/main/javadoc") {
109+
include "**/doc-files/**";
110+
};
111+
into javadoc.destinationDir;
112+
}
134113
}
135114
}
136115

@@ -164,38 +143,42 @@ artifacts {
164143
}
165144

166145
task wrapper(type: Wrapper) {
167-
gradleVersion = "1.11";
146+
gradleVersion = "3.5";
168147
distributionUrl = "http://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip";
169148
}
170149

171-
task pom << {
172-
pom {}.writeTo("${projectDir}/pom.xml");
150+
task pom {
151+
doLast {
152+
pom {}.writeTo("${projectDir}/pom.xml");
153+
}
173154
}
174155

175156
/*
176157
* SIGNING
177158
*/
178159

179160
project.ext {
180-
gitrwscm = sprintf("git@github.com:fge/%s", name);
181-
gitroscm = sprintf("https://github.com/fge/%s.git", name);
182-
projectURL = sprintf("https://github.com/fge/%s", name);
161+
description = "A Java implementation of the JSON Schema specification";
162+
scmUrl = sprintf("git@github.com:box-metadata/%s", name);
163+
projectURL = sprintf("https://github.com/box-metadata/%s", name);
183164
sonatypeStaging = "https://oss.sonatype.org/service/local/staging/deploy/maven2/";
184165
sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots/";
185166
};
186167

187-
task checkSigningRequirements << {
188-
def requiredProperties = [ "sonatypeUsername", "sonatypePassword" ];
189-
def noDice = false;
190-
requiredProperties.each {
191-
if (project.properties[it] == null) {
192-
noDice = true;
193-
System.err.printf("property \"%s\" is not defined!", it);
168+
task checkSigningRequirements {
169+
doLast {
170+
def requiredProperties = [ "sonatypeUsername", "sonatypePassword" ];
171+
def noDice = false;
172+
requiredProperties.each {
173+
if (project.properties[it] == null) {
174+
noDice = true;
175+
System.err.printf("property \"%s\" is not defined!", it);
176+
}
194177
}
178+
if (noDice)
179+
throw new IllegalStateException("missing required properties for " +
180+
"upload");
195181
}
196-
if (noDice)
197-
throw new IllegalStateException("missing required properties for " +
198-
"upload");
199182
}
200183

201184
uploadArchives {
@@ -231,15 +214,15 @@ uploadArchives {
231214
uploadArchives.repositories.mavenDeployer
232215
]*.pom*.whenConfigured { pom ->
233216
pom.project {
234-
name "${name}";
217+
name "${project.name}";
235218
packaging "jar";
236-
description "${description}";
219+
description "${project.ext.description}";
237220
url "${projectURL}";
238221

239222
scm {
240-
url "${gitrwscm}";
241-
connection "${gitrwscm}";
242-
developerConnection "${gitroscm}";
223+
url "${scmUrl}";
224+
connection "scm:git:${scmUrl}";
225+
developerConnection "scm:git:${scmUrl}";
243226
}
244227

245228
licenses {
@@ -257,9 +240,9 @@ uploadArchives {
257240

258241
developers {
259242
developer {
260-
id "fge";
261-
name "Francis Galiegue";
262-
email "fgaliegue@gmail.com";
243+
id "huggsboson";
244+
name "John Huffaker";
245+
email "jhuffaker+java-json-tools@gmail.com";
263246
}
264247
}
265248
}

dorelease.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
#!/bin/bash
22

3+
# Release instructions
4+
# 1. Follow the gpg setup instructions: http://central.sonatype.org/pages/working-with-pgp-signatures.html
5+
# a. gpg2 --export-secret-keys > ~/.gnupg/secring.gpg
6+
# 2. In ~/.gradle add:
7+
# sonatypeUsername=your sonatype user name
8+
# sonatypePassword=password in vault for oss sonatype<ensure newline>
9+
#
10+
# signing.keyId=generated key
11+
# signing.password=password for gpg key
12+
# signing.secretKeyRingFile=/Users/username/.gnupg/secring.gpg
13+
#
14+
# 3. ./dorelease.sh
15+
# 4. Go to UI at: https://oss.sonatype.org
16+
# 5. Login as sonatypeUsername
17+
# 6. Follow the instructions here: http://central.sonatype.org/pages/releasing-the-deployment.html
18+
319
./gradlew --recompile-scripts clean test uploadArchives
420

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
1-
#
2-
# Copyright (c) 2014, Francis Galiegue (fgaliegue@gmail.com)
3-
#
4-
# This software is dual-licensed under:
5-
#
6-
# - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
7-
# later version;
8-
# - the Apache Software License (ASL) version 2.0.
9-
#
10-
# The text of this file and of both licenses is available at the root of this
11-
# project or, if you have the jar distribution, in directory META-INF/, under
12-
# the names LGPL-3.0.txt and ASL-2.0.txt respectively.
13-
#
14-
# Direct link to the sources:
15-
#
16-
# - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
17-
# - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
18-
#
19-
20-
#Mon Apr 14 09:45:58 CEST 2014
1+
#Fri Jun 02 16:48:25 PDT 2017
212
distributionBase=GRADLE_USER_HOME
223
distributionPath=wrapper/dists
234
zipStoreBase=GRADLE_USER_HOME
245
zipStorePath=wrapper/dists
25-
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
6+
distributionUrl=http\://services.gradle.org/distributions/gradle-3.5-all.zip

src/main/java/com/github/fge/jsonschema/format/common/DateTimeAttribute.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public final class DateTimeAttribute
4242
extends AbstractFormatAttribute
4343
{
4444
private static final List<String> FORMATS = ImmutableList.of(
45-
"yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
45+
"yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,12}Z"
4646
);
4747
private static final DateTimeFormatter FORMATTER;
4848

4949
static {
50-
final DateTimeParser msParser = new DateTimeFormatterBuilder()
51-
.appendLiteral('.').appendDecimal(millisOfSecond(), 1, 3)
50+
final DateTimeParser secFracsParser = new DateTimeFormatterBuilder()
51+
.appendLiteral('.').appendFractionOfSecond(1,12)
5252
.toParser();
5353

5454
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
@@ -64,7 +64,7 @@ public final class DateTimeAttribute
6464
.appendFixedDecimal(minuteOfHour(), 2)
6565
.appendLiteral(':')
6666
.appendFixedDecimal(secondOfMinute(), 2)
67-
.appendOptional(msParser)
67+
.appendOptional(secFracsParser)
6868
.appendTimeZoneOffset("Z", false, 2, 2);
6969

7070
FORMATTER = builder.toFormatter();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.github.fge.jsonschema.keyword.validator;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
import com.github.fge.jsonschema.core.exceptions.ProcessingException;
5+
6+
/**
7+
* Interface for a keyword validator factory
8+
*/
9+
public interface KeywordValidatorFactory
10+
{
11+
/**
12+
* Create a validator for the instance
13+
*
14+
* @param node the instance to validate
15+
* @return a validator for the given instance
16+
* @throws ProcessingException an error occurs creating the validator
17+
*/
18+
KeywordValidator getKeywordValidator(JsonNode node)
19+
throws ProcessingException;
20+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.github.fge.jsonschema.keyword.validator;
2+
3+
import java.lang.reflect.Constructor;
4+
import java.lang.reflect.InvocationTargetException;
5+
6+
import com.fasterxml.jackson.databind.JsonNode;
7+
import com.github.fge.jsonschema.core.exceptions.ProcessingException;
8+
import com.github.fge.jsonschema.messages.JsonSchemaConfigurationBundle;
9+
import com.github.fge.msgsimple.bundle.MessageBundle;
10+
import com.github.fge.msgsimple.load.MessageBundles;
11+
12+
/**
13+
* A validator factory that uses reflection to create an instance of the
14+
* specified KeywordValidator class
15+
*/
16+
public class ReflectionKeywordValidatorFactory
17+
implements KeywordValidatorFactory
18+
{
19+
private static final String ERRMSG = "failed to build keyword validator";
20+
private static final MessageBundle BUNDLE
21+
= MessageBundles.getBundle(JsonSchemaConfigurationBundle.class);
22+
23+
private final Constructor<? extends KeywordValidator> constructor;
24+
25+
public ReflectionKeywordValidatorFactory(String name,
26+
Class<? extends KeywordValidator> clazz)
27+
{
28+
try {
29+
constructor = clazz.getConstructor(JsonNode.class);
30+
} catch (NoSuchMethodException ignored) {
31+
throw new IllegalArgumentException(BUNDLE.printf(
32+
"noAppropriateConstructor", name, clazz.getCanonicalName()
33+
));
34+
}
35+
}
36+
37+
@Override
38+
public KeywordValidator getKeywordValidator(JsonNode node)
39+
throws ProcessingException
40+
{
41+
try {
42+
return constructor.newInstance(node);
43+
} catch (InstantiationException e) {
44+
throw new ProcessingException(ERRMSG, e);
45+
} catch (IllegalAccessException e) {
46+
throw new ProcessingException(ERRMSG, e);
47+
} catch (InvocationTargetException e) {
48+
throw new ProcessingException(ERRMSG, e);
49+
}
50+
}
51+
52+
}

0 commit comments

Comments
 (0)