GillianPerard / typescript-json-serializer

A typescript library to deserialize json into typescript classes and serialize classes into json.
MIT License
210 stars 29 forks source link

[BUG]: Fail to deserialize: Property 'name' is required in Employee #191

Closed dawadam closed 1 year ago

dawadam commented 1 year ago

Version

5.0.0

Description

Hi, thanks for this great job. I'm just testing example, bug error appear.

Error

Fail to deserialize: Property 'name' is required in Employee {"employeeId":1,"name":"Bob Razowsky","birthDate":"1984-04-03T22:00:00.000Z","email":"bob.razowsky@tgzoo.fr","gender":1,"phoneNumber":"111-111-1111"}.
Fail to deserialize: Property 'name' is required in Employee {"employeeId":1,"name":"Bob Razowsky","birthDate":"1984-04-03T22:00:00.000Z","email":"bob.razowsky@tgzoo.fr","gender":1,"phoneNumber":"111-111-1111"}.
Fail to deserialize: Property 'name' is required in Employee {"employeeId":2,"name":"Mikasa Ackerman","birthDate":"1984-01-11T22:00:00.000Z","email":"mikasa.ackerman@tgzoo.fr","gender":0,"phoneNumber":"222-222-2222"}.
Fail to deserialize: Property 'name' is required in Employee {"employeeId":3,"name":"Red Redington","birthDate":"1970-12-04T22:00:00.000Z","email":"red.redington@tgzoo.fr","gender":1,"phoneNumber":"333-333-3333"}.
Fail to deserialize: Property 'name' is required in Employee {"employeeId":4,"name":"Fried Richter","birthDate":"1994-04-01T22:00:00.000Z","email":"fried.richter@tgzoo.fr","gender":1}.
Fail to deserialize: Property 'name' is required in Employee {"employeeId":2,"name":"Sully","birthDate":"1984-08-03T22:00:00.000Z","email":"sully.razowsky@tgzoo.fr","gender":1,"phoneNumber":{"countryCode":"33","value":"0111111111"}}.

Reproduction

Using exemple code.

On which OS the bug appears?

linux

What is your project type?

Node

On which build mode the bug appears?

No response

Anything else?

No response

GillianPerard commented 1 year ago

Hi, you're right, there is a problem inside the example of the README.

You can take the examples from the repository; I tested it, and it works properly.

I'll fix the README asap.

GillianPerard commented 1 year ago

Fixed!