Small package which wraps error responses to follow jsonapi.org

Go-JsonError

Go Report Card Build Status Coveragestatus GoDoc Mentioned in Awesome Go

Go-JsonError is meant to allow us to easily create json response errors that follow the JsonApi spec.

Json API Spec

Usuage

In order to use jsonError you will need to initliaze the ErrorJson struct. Then when you would like to add an error you must pass in a ErrorComp struct to the AddError().

This follows the jsonapi spec where the error response must return an array.

Here is a basic example

	var err ErrorJSON

	errorComposition := ErrorComp{
		Detail: "this is a error message",
		Code:   "This is the code",
		Source: Source{
			Pointer: "/unit/tests",
		},
		Title:  "Title Test",
		Status: 200,
	}

	err.AddError(errorComposition)

	err.Error()
	err.ErrorByte()

Running the tests

This package is just using the standard test packge included with go. You can run the test cases with

go test ./...

Contributing

Please feel free to submit any pull requests.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • David Dymko

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Owner
David Dymko
It writes the code in the IDE or else it gets the hose again
David Dymko
Similar Resources

a small form factor OpenShift/Kubernetes optimized for edge computing

Microshift Microshift is OpenShift1 Kubernetes in a small form factor and optimized for edge computing. Edge devices deployed out in the field pose ve

Dec 29, 2022

Small and easy server for web-hooks to deploy software on push from gitlab/github/hg and so on

Deployment mini-service This mini web-server is made to deploy your code without yaml-files headache. If you just need to update your code somewhere a

Dec 4, 2022

Small skeleton app running on k8s

k8s-go-app Small skeleton app running on k8s Usage NOTE Please replace ${repositry} in below and k8s/*.yml to point your private/public repositry. doc

Jul 30, 2022

Small helper to bridge between Vault and AWS Credential Process.

vault-aws-credential-helper The Vault AWS Credential Helper is a component that can be injected into a task environment and be used as a credential he

Nov 21, 2021

Small demo of using physac 2d physics engine in golang

Physac-go 2D physics engine in golang For now this is just a small demo. Maybe later I'll convert it into a proper module. References Original Physac

Jul 26, 2022

A small application to find pod ip address by service name using go

k8s podipfinder This is a small application to find pod ip address by service na

Dec 29, 2021

Small tool to pull/push several projects in one go

gitTool Small tool to push and pull several projects in one go. Written in Go 1.17 by Roy Dybing Contact: location name/handle github: rDybing linked

Dec 28, 2021

A simple download file manager that sorts your files into your desired folders, This was meant to be a small project and nothing big.

GoDFM Simply go to the tags and download the .exe file (or compile it yourself by running go build). Add it to your environment paths by going to sett

Aug 9, 2022

A small drunken bishop written in Go to represent bytes.

Go, Little Drunken Bishop! go get github.com/eloonstra/go-little-drunken-bishop Table of Contents How does it work? Usage Example License Contributin

Mar 13, 2022
Comments
  • lowercase errors key in the json response

    lowercase errors key in the json response

    Hi, thanks for the library, it works great but I was wondering if the "Errors" key in the response shouldn't be lowercase, as that is how json api spec is showing it - https://jsonapi.org/format/1.1/#error-objects

    It would probably be a breaking change for existing projects so I'm writing it here first but I'd be happy to post a pull request fixing it.

    Best Regard, Lukas.

Clones github projects into ~/Projects/github/{org}/{repo}

Tidy clone Github cli extension (gh extension) to clone repos into ~/Projects/github/{org}/{repo} on the local filesystem Install gh extension install

Jan 19, 2022
A simple project (which is visitor counter) on kubernetesA simple project (which is visitor counter) on kubernetes

k8s playground This project aims to deploy a simple project (which is visitor counter) on kubernetes. Deploy steps kubectl apply -f secret.yaml kubect

Dec 16, 2022
Tool which gathers basic info from apk, which can be used for Android penetration testing.
Tool which gathers basic info from apk, which can be used for Android penetration testing.

APKSEC Tool which gathers basic info from apk, which can be used for Android penetration testing. REQUIREMENTS AND INSTALLATION Build APKSEC: git clon

Sep 2, 2022
An operator which complements grafana-operator for custom features which are not feasible to be merged into core operator

Grafana Complementary Operator A grafana which complements grafana-operator for custom features which are not feasible to be merged into core operator

Aug 16, 2022
SLOs, Error windows and alerts are complicated. Here an attempt to make it easy

slo-computer SLOs, Error windows and alerts are complicated. Here's an attempt to make it easy SLO, burn_rate, error_rate, budget_spend are convoluted

Dec 30, 2022
A very simple utility that allows you to run the desired command or script as soon as a certain process with a known PID completes correctly or with an error.

go-monkill A very simple utility that allows you to run the desired command or script as soon as a certain process with a known PID completes correctl

Dec 17, 2022
Errhandle - A golang error handling framework

errhandle A golang error handling framework About errhandle: An error handling f

Jan 3, 2022
A package manager written in Go which uses the LFS Symlink method.

pacsym A package manager powered by symlinks. How to use The package manager assumes that all software installed is installed with /usr/pkg/<packagena

Dec 11, 2021
This library provides a metrics package which can be used to instrument code, expose application metrics, and profile runtime performance in a flexible manner.

This library provides a metrics package which can be used to instrument code, expose application metrics, and profile runtime performance in a flexible manner.

Jan 18, 2022
Go-reconcile - Super tiny go package which does reconcile planning

go-reconcile Super tiny go package which does reconcile planning: taking desired

Mar 1, 2022