-
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.
Allow noline schemas and custom file extensions
- Loading branch information
Showing
7 changed files
with
126 additions
and
15 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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/trickl/assertj/core/api/json/serialize/NoInlineSchemaVisitorContext.java
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.trickl.assertj.core.api.json.serialize; | ||
|
||
import com.fasterxml.jackson.databind.JavaType; | ||
import com.fasterxml.jackson.module.jsonSchema.factories.VisitorContext; | ||
|
||
public class NoInlineSchemaVisitorContext extends VisitorContext { | ||
@Override | ||
public String getSeenSchemaUri(JavaType javaType) { | ||
if (javaType != null && !javaType.isPrimitive()) { | ||
return javaTypeToUrn(javaType); | ||
} | ||
return null; | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/test/java/com/trickl/assertj/examples/NestedExample.java
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.trickl.assertj.examples; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class NestedExample { | ||
@JsonProperty("first-example") | ||
private Example firstExample; | ||
|
||
@JsonProperty("second-example") | ||
private Example secondExample; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/resources/com/trickl/assertj/examples/NestedExample.schema.json
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "urn:jsonschema:com:trickl:assertj:examples:NestedExample", | ||
"type": "object", | ||
"properties": { | ||
"second-example": { | ||
"type": "object", | ||
"$ref": "urn:jsonschema:com:trickl:assertj:examples:Example" | ||
}, | ||
"first-example": { | ||
"type": "object", | ||
"$ref": "urn:jsonschema:com:trickl:assertj:examples:Example" | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/resources/com/trickl/assertj/examples/NestedExample.schema2.json
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"id": "urn:jsonschema:com:trickl:assertj:examples:NestedExample", | ||
"type": "object", | ||
"properties": { | ||
"second-example": { | ||
"type": "object", | ||
"$ref": "urn:jsonschema:com:trickl:assertj:examples:Example" | ||
}, | ||
"first-example": { | ||
"id": "urn:jsonschema:com:trickl:assertj:examples:Example", | ||
"type": "object", | ||
"properties": { | ||
"my-field": { | ||
"description": "Description of my field", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |