FasterXML / FasterXML/jackson-module-jsonSchema

Instant serialized to wrong type

Aberta
#121 9 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Java
Estrelas
387
Forks
136
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

# 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"

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.