Skip to content

Commit 4b0e239

Browse files
committed
Move to Jackson 3
1 parent c8f2cf4 commit 4b0e239

141 files changed

Lines changed: 1254 additions & 1261 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
java_version: ['8', '11', '17']
15+
java_version: ['17']
1616
env:
1717
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
1818
steps:

‎README.md‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,28 @@ And if necessary, more if future revisions also prove incompatible.
1111
## Status
1212

1313
[![Build Status](https://travis-ci.org/FasterXML/jackson-module-jsonSchema.svg)](https://travis-ci.org/FasterXML/jackson-module-jsonSchema)
14-
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.module/jackson-module-jsonSchema/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.module/jackson-module-jsonSchema/)
15-
[![Javadoc](https://javadoc.io/badge/com.fasterxml.jackson.module/jackson-module-jsonSchema.svg)](http://www.javadoc.io/doc/com.fasterxml.jackson.module/jackson-module-jsonSchema)
14+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/tools.jackson.module/jackson-module-jsonSchema/badge.svg)](https://maven-badges.herokuapp.com/maven-central/tools.jackson.module/jackson-module-jsonSchema/)
15+
[![Javadoc](https://javadoc.io/badge/tools.jackson.module/jackson-module-jsonSchema.svg)](http://www.javadoc.io/doc/tools.jackson.module/jackson-module-jsonSchema)
1616

1717
Version 2.4 was considered the first stable version of the module.
1818

19-
## Two modules (with Jackson 2.15)
19+
## Two modules
2020

21-
Starting with upcoming Jackson 2.15, this repository contains TWO versions of the module:
21+
This repository contains TWO versions of the module:
2222

23-
1. Old JSON Schema module `com.fasterxml.jackson.module:jackson-module-jsonSchema` (since 2.0)
24-
2. New JSON Schema module `com.fasterxml.jackson.module:jackson-module-jsonSchema-jakarta` (2.15+)
23+
1. javax: `tools.jackson.module:jackson-module-jsonSchema`
24+
2. jakarta: `tools.jackson.module:jackson-module-jsonSchema-jakarta`
2525

2626
depending on whether system needs to work with "old" `javax`/`JAXB` APIs (first module) or newer "Jakarta" APIs.
2727

28-
## Future plans (lack thereof)
29-
30-
Due to lack of support by community, this module is NOT planned to be supported beyond
31-
Jackson 2.x -- no work has been done for it to work with future Jackson 3.0.
32-
Users are encouraged to use more up-to-date JSON Schema support tools.
33-
3428
## Example Usage
3529

3630
(from [TestGenerateJsonSchema](https://github.com/FasterXML/jackson-module-jsonSchema/blob/master/javax/src/test/java/com/fasterxml/jackson/module/jsonSchema/TestGenerateJsonSchema.java#L136))
3731

3832
simply add a dependency
39-
`"com.fasterxml.jackson.module:jackson-module-jsonSchema:2.15.0"`
33+
`"tools.jackson.module:jackson-module-jsonSchema:3.1.0"`
4034
or
41-
`"com.fasterxml.jackson.module:jackson-module-jsonSchema-jakarta:2.15.0"` for the jakarta namespace
35+
`"tools.jackson.module:jackson-module-jsonSchema-jakarta:3.1.0"` for the jakarta namespace
4236

4337
and for gradle, at least, you can simply add `mavenLocal()` to your repositories.
4438
Maven should resolve the dependency from its local repo transparently.
@@ -54,7 +48,7 @@ This will yield a java pojo representing a JSON Schema, which can itself easily
5448

5549
## Adding Property Processing
5650

57-
See `com.fasterxml.jackson.module.jsonSchema.customProperties.TitleSchemaFactoryWrapper` for an example of writing custom schema properties.
51+
See `customProperties.tools.jackson.module.jsonSchema.TitleSchemaFactoryWrapper` for an example of writing custom schema properties.
5852

5953
## Required Fields
6054

@@ -68,7 +62,7 @@ Currently 2 aspects of IETF supported:
6862
* pathStart - URI that defines what the instance's URI MUST start with in order to validate.
6963
* links - associated Link Description Objects with instances.
7064

71-
You can enable HypermediaSupport using `com.fasterxml.jackson.module.jsonSchema.customProperties.HyperSchemaFactoryWrapper`.
65+
You can enable HypermediaSupport using `customProperties.tools.jackson.module.jsonSchema.HyperSchemaFactoryWrapper`.
7266
Example:
7367

7468
```java

‎jakarta/pom.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<!-- do_not_remove: published-with-gradle-metadata -->
77
<modelVersion>4.0.0</modelVersion>
88
<parent>
9-
<groupId>com.fasterxml.jackson.module</groupId>
9+
<groupId>tools.jackson.module</groupId>
1010
<artifactId>jackson-module-jsonSchema-parent</artifactId>
11-
<version>2.21.0-SNAPSHOT</version>
11+
<version>3.1.0-SNAPSHOT</version>
1212
</parent>
1313
<artifactId>jackson-module-jsonSchema-jakarta</artifactId>
1414
<name>jackson-module-jsonSchema-jakarta</name>
@@ -34,7 +34,7 @@ JSON Schema (http://tools.ietf.org/html/draft-zyp-json-schema-03) version 3 gene
3434
<version>${version.plugin.surefire}</version>
3535
<configuration>
3636
<excludes>
37-
<exclude>com/fasterxml/jackson/module/jsonSchema/jakarta/failing/*.java</exclude>
37+
<exclude>tools/jackson/module/jsonSchema/jakarta/failing/*.java</exclude>
3838
</excludes>
3939
</configuration>
4040
</plugin>

‎jakarta/src/main/java/com/fasterxml/jackson/module/jsonSchema/jakarta/factories/ObjectVisitorDecorator.java‎

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎jakarta/src/main/java/com/fasterxml/jackson/module/jsonSchema/jakarta/factories/StructuredTypeVisitor.java‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

jakarta/src/main/java/com/fasterxml/jackson/module/jsonSchema/jakarta/JsonSchema.java renamed to jakarta/src/main/java/tools/jackson/module/jsonSchema/jakarta/JsonSchema.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
package com.fasterxml.jackson.module.jsonSchema.jakarta;
1+
package tools.jackson.module.jsonSchema.jakarta;
22

33
import com.fasterxml.jackson.annotation.JsonIgnore;
44
import com.fasterxml.jackson.annotation.JsonInclude;
55
import com.fasterxml.jackson.annotation.JsonProperty;
66
import com.fasterxml.jackson.annotation.JsonTypeInfo;
77
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
88
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
9-
import com.fasterxml.jackson.databind.BeanProperty;
10-
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
11-
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
12-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.AnySchema;
13-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ArraySchema;
14-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.BooleanSchema;
15-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ContainerTypeSchema;
16-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.IntegerSchema;
17-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.NullSchema;
18-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.NumberSchema;
19-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ObjectSchema;
20-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.SimpleTypeSchema;
21-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.StringSchema;
22-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.UnionTypeSchema;
23-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ValueTypeSchema;
9+
import tools.jackson.databind.BeanProperty;
10+
import tools.jackson.databind.annotation.JsonTypeIdResolver;
11+
import tools.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
12+
import tools.jackson.module.jsonSchema.jakarta.types.AnySchema;
13+
import tools.jackson.module.jsonSchema.jakarta.types.ArraySchema;
14+
import tools.jackson.module.jsonSchema.jakarta.types.BooleanSchema;
15+
import tools.jackson.module.jsonSchema.jakarta.types.ContainerTypeSchema;
16+
import tools.jackson.module.jsonSchema.jakarta.types.IntegerSchema;
17+
import tools.jackson.module.jsonSchema.jakarta.types.NullSchema;
18+
import tools.jackson.module.jsonSchema.jakarta.types.NumberSchema;
19+
import tools.jackson.module.jsonSchema.jakarta.types.ObjectSchema;
20+
import tools.jackson.module.jsonSchema.jakarta.types.SimpleTypeSchema;
21+
import tools.jackson.module.jsonSchema.jakarta.types.StringSchema;
22+
import tools.jackson.module.jsonSchema.jakarta.types.UnionTypeSchema;
23+
import tools.jackson.module.jsonSchema.jakarta.types.ValueTypeSchema;
2424

2525
/**
2626
* The type wraps the json schema specification at :

javax/src/main/java/com/fasterxml/jackson/module/jsonSchema/JsonSchemaGenerator.java renamed to jakarta/src/main/java/tools/jackson/module/jsonSchema/jakarta/JsonSchemaGenerator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.fasterxml.jackson.module.jsonSchema;
1+
package tools.jackson.module.jsonSchema.jakarta;
22

3-
import com.fasterxml.jackson.databind.*;
4-
import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper;
5-
import com.fasterxml.jackson.module.jsonSchema.factories.WrapperFactory;
3+
import tools.jackson.databind.*;
4+
import tools.jackson.module.jsonSchema.jakarta.factories.SchemaFactoryWrapper;
5+
import tools.jackson.module.jsonSchema.jakarta.factories.WrapperFactory;
66

77
/**
88
* Convenience class that wraps JSON Schema generation functionality.
@@ -80,7 +80,7 @@ public JsonSchemaGenerator(ObjectWriter w, SchemaFactoryWrapper visitor) {
8080
_visitor = visitor;
8181
}
8282

83-
public JsonSchema generateSchema(Class<?> type) throws JsonMappingException
83+
public JsonSchema generateSchema(Class<?> type)
8484
{
8585
SchemaFactoryWrapper visitor = _visitor;
8686
if (visitor == null) {
@@ -90,7 +90,7 @@ public JsonSchema generateSchema(Class<?> type) throws JsonMappingException
9090
return visitor.finalSchema();
9191
}
9292

93-
public JsonSchema generateSchema(JavaType type) throws JsonMappingException
93+
public JsonSchema generateSchema(JavaType type)
9494
{
9595
SchemaFactoryWrapper visitor = _visitor;
9696
if (visitor == null) {

jakarta/src/main/java/com/fasterxml/jackson/module/jsonSchema/jakarta/JsonSchemaIdResolver.java renamed to jakarta/src/main/java/tools/jackson/module/jsonSchema/jakarta/JsonSchemaIdResolver.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
package com.fasterxml.jackson.module.jsonSchema.jakarta;
1+
package tools.jackson.module.jsonSchema.jakarta;
22

33
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
4-
import com.fasterxml.jackson.databind.DatabindContext;
5-
import com.fasterxml.jackson.databind.JavaType;
6-
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
7-
import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;
8-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.AnySchema;
9-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ArraySchema;
10-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.BooleanSchema;
11-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.IntegerSchema;
12-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.NullSchema;
13-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.NumberSchema;
14-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.ObjectSchema;
15-
import com.fasterxml.jackson.module.jsonSchema.jakarta.types.StringSchema;
4+
import tools.jackson.databind.DatabindContext;
5+
import tools.jackson.databind.JavaType;
6+
import tools.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
7+
import tools.jackson.databind.jsontype.impl.TypeIdResolverBase;
8+
import tools.jackson.module.jsonSchema.jakarta.types.AnySchema;
9+
import tools.jackson.module.jsonSchema.jakarta.types.ArraySchema;
10+
import tools.jackson.module.jsonSchema.jakarta.types.BooleanSchema;
11+
import tools.jackson.module.jsonSchema.jakarta.types.IntegerSchema;
12+
import tools.jackson.module.jsonSchema.jakarta.types.NullSchema;
13+
import tools.jackson.module.jsonSchema.jakarta.types.NumberSchema;
14+
import tools.jackson.module.jsonSchema.jakarta.types.ObjectSchema;
15+
import tools.jackson.module.jsonSchema.jakarta.types.StringSchema;
1616
import java.util.Arrays;
1717

1818
/**
1919
* Type id resolver needed to support polymorphic (de)serialization of all kinds of
2020
* {@link JsonSchema} instances.
2121
* Note that to support custom types, you will need to sub-class this resolver
22-
* and override at least {@link #idFromValue(Object)}, {@link #idFromValueAndType(Object, Class)} and
22+
* and override at least {@link #idFromValue(DatabindContext, Object)}, {@link #idFromValueAndType(DatabindContext, Object, Class)} and
2323
* {@link #typeFromId} methods; as well as associate this resolver using
2424
* {@link com.fasterxml.jackson.annotation.JsonTypeInfo} annotation on
2525
* all custom {@link JsonSchema} implementation classes.
@@ -29,16 +29,16 @@ public class JsonSchemaIdResolver extends TypeIdResolverBase
2929
public JsonSchemaIdResolver() { }
3030

3131
@Override
32-
public String idFromValue(Object value) {
32+
public String idFromValue(DatabindContext ctxt, Object value) {
3333
if (value instanceof JsonSchema) {
3434
return ((JsonSchema)value).getType().value();
3535
}
3636
return null;
3737
}
3838

3939
@Override
40-
public String idFromValueAndType(Object value, Class<?> suggestedType) {
41-
return idFromValue(value);
40+
public String idFromValueAndType(DatabindContext ctxt, Object value, Class<?> suggestedType) {
41+
return idFromValue(ctxt, value);
4242
}
4343

4444
@Override
@@ -80,7 +80,7 @@ public Id getMechanism() {
8080
public void init(JavaType baseType) { }
8181

8282
@Override
83-
public String idFromBaseType() {
83+
public String idFromBaseType(DatabindContext ctxt) {
8484
return null;
8585
}
8686
}

javax/src/main/java/com/fasterxml/jackson/module/jsonSchema/annotation/JsonHyperSchema.java renamed to jakarta/src/main/java/tools/jackson/module/jsonSchema/jakarta/annotation/JsonHyperSchema.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.module.jsonSchema.annotation;
1+
package tools.jackson.module.jsonSchema.jakarta.annotation;
22

33
import java.lang.annotation.*;
44

javax/src/main/java/com/fasterxml/jackson/module/jsonSchema/annotation/Link.java renamed to jakarta/src/main/java/tools/jackson/module/jsonSchema/jakarta/annotation/Link.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.module.jsonSchema.annotation;
1+
package tools.jackson.module.jsonSchema.jakarta.annotation;
22

33
/**
44
* A link description object is used to describe link relations. In the

0 commit comments

Comments
 (0)