FasterXML / FasterXML/jackson-module-jsonSchema

Instant serialized to wrong type

オープン
#121 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
387
フォーク
136
PR マージ指標
30日以内にマージされた PR はありません

説明

# version

2.8

# Description

I have serialized the following entity :

```json
{
"createdDate": {
"nano": 326000000,
"epochSecond": 1484986332
},
"lastModifiedDate": null,
"createdById": null,
"lastModifiedById": null,
"active": true,
"login": "admin",
"roleList": [
"ROLE_MANAGER",
"ROLE_ADMIN"
],
"username": "admin",
"enabled": true,
"authorities": [
{
"authority": "ROLE_MANAGER"
},
{
"authority": "ROLE_ADMIN"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true,
"new": false
}
```

And it's schema json :

```json
{
"title": "Manager",
"properties": {
"new": {
"title": "New",
"readOnly": true,
"type": "boolean"
},
"lastModifiedDate": {
"title": "Last modified date",
"readOnly": false,
"type": "string",
"format": "date-time",
"$ref": "#/definitions/instant"
},
"credentialsNonExpired": {
"title": "Credentials non expired",
"readOnly": true,
"type": "boolean"
},
"active": {
"title": "Active",
"readOnly": false,
"type": "boolean"
},
"login": {
"title": "Login",
"readOnly": false,
"type": "string"
},
"roleList": {
"title": "Role list",
"readOnly": false,
"type": "array",
"items": {
"type": "string"
}
},
"enabled": {
"title": "Enabled",
"readOnly": true,
"type": "boolean"
},
"authorities": {
"title": "Authorities",
"readOnly": true,
"type": "array",
"items": {
"type": "object"
}
},
"createdDate": {
"title": "Created date",
"readOnly": false,
"type": "string",
"format": "date-time",
"$ref": "#/definitions/instant"
},
"lastModifiedById": {
"title": "Last modified by id",
"readOnly": false,
"type": "integer"
},
"accountNonExpired": {
"title": "Account non expired",
"readOnly": true,
"type": "boolean"
},
"createdById": {
"title": "Created by id",
"readOnly": false,
"type": "integer"
},
"username": {
"title": "Username",
"readOnly": true,
"type": "string"
},
"accountNonLocked": {
"title": "Account non locked",
"readOnly": true,
"type": "boolean"
}
},
"definitions": {
"instant": {
"type": "string",
"properties": {
"nano": {
"title": "Nano",
"readOnly": true,
"type": "integer"
},
"epochSecond": {
"title": "Epoch second",
"readOnly": true,
"type": "integer"
}
}
}
},
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#"
}
```

I have test on http://www.jsonschemavalidator.net/ :

```ruby
Found 2 error(s)
Message:
Invalid type. Expected String but got Object.
Schema path:
#/definitions/instant/type
Message:
Invalid type. Expected String but got Object.
Schema path:
#/definitions/instant/type
```

It appear jackson try to serialize a java `Instant` but the generated schema contain the wrong type "object" instead of "string"

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。