Skip to content

Instantly share code, notes, and snippets.

@jednano
Last active January 30, 2019 21:19
Show Gist options
  • Save jednano/cae1d7df45ff4b10279d8a7ae1df75e5 to your computer and use it in GitHub Desktop.
Save jednano/cae1d7df45ff4b10279d8a7ae1df75e5 to your computer and use it in GitHub Desktop.
export default interface ResponsePayload {
errors?: ResponsePayloadError[];
// tslint:disable-next-line:no-any
[key: string]: any;
}
/**
* https://jsonapi.org/format/#error-objects
*/
export interface ResponsePayloadError {
/**
* A unique identifier for this particular occurrence of the problem.
*/
id?: string;
/**
* https://jsonapi.org/format/#document-links
*/
links?: {
/**
* A [link](https://jsonapi.org/format/#document-links) that leads to
* further details about this particular occurrence of the problem.
*/
about: string;
};
/**
* The HTTP status code applicable to this problem.
*/
status?: string;
/**
* An application-specific error code.
*/
code?: string;
/**
* A short, human-readable summary of the problem that **SHOULD NOT** change
* from occurrence to occurrence of the problem, except for purposes of
* localization.
*/
title?: string;
/**
* A human-readable explanation specific to this occurence of the problem.
* Like `title`, this field's value can be localized.
*/
detail?: string;
/**
* Contains references to the source of the error.
*/
source?: {
/**
* A JSON `Pointer` [RFC6901](https://tools.ietf.org/html/rfc6901) to
* the associated entity in the request document [e.g., `"/data"` for
* a primary data object, or `"/data/attributes/title"` for a specific
* attribute].
*/
pointer?: string;
/**
* A string indicating which URI query parameter caused the error.
*/
parameter?: string;
};
/**
* A [meta object](http://www.google.com) containing non-standard
* meta-information about the error.
*/
meta?: {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment