Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null string deserialization typecheck fix #2022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tchaloupka
Copy link
Contributor

Just a simple exception to pass Json.Type.null_ as a string too as string can be set to null in the json data.

Without this I get this error when not used with the Nullable in the REST API:

Exception while handling request POST /api/v1/events/iot/temp: vibe.http.common.HTTPStatusException@/home/tomas/.dub/packages/vibe-d-0.8.2/vibe-d/web/vibe/web/rest.d(1333): Got JSON of type null_, expected string.
----------------
/usr/include/dmd/phobos/std/exception.d:556 pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy object.Throwable) [0xd1bc30]
/home/tomas/.dub/packages/vibe-d-0.8.2/vibe-d/http/vibe/http/common.d:161 @safe bool vibe.http.common.enforceHTTP!(bool).enforceHTTP(bool, vibe.http.status.HTTPStatus, lazy immutable(char)[], immutable(char)[], int) [0xd33cd7]
/home/tomas/.dub/packages/vibe-d-0.8.2/vibe-d/http/vibe/http/common.d:169 @safe bool vibe.http.common.enforceBadRequest!(bool).enforceBadRequest(bool, lazy immutable(char)[], immutable(char)[], int) [0xd7d734]
/home/tomas/.dub/packages/vibe-d-0.8.2/vibe-d/web/vibe/web/rest.d:1333 @safe void vibe.web.rest.jsonMethodHandler

but I'm not sure if this is ok to add or even enough. What with structs/classes or arrays in the same scenario?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant