type-errors

command
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 3 Imported by: 0

README

This example shows how you might generate a JSON response if the client's request has some type errors.

Model

type Person struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Age       int    `json:"age"`
}

Input

{
    "first_name": "Jessie",
    "age": "26"
}

Output

{
    "errors": {
        "age": "expected an int but it's a string"
    },
    "ok": false
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL