FasterXML / FasterXML/jackson-module-jsonSchema
Instant serialized to wrong type
- Lenguaje dominante
- Java
- Estrellas
- 387
- Forks
- 136
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
# 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"
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.