Skip to content

Instantly share code, notes, and snippets.

@dwickern
Created August 28, 2017 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwickern/b484495ac6117100ee49a22c4b38b2b6 to your computer and use it in GitHub Desktop.
Save dwickern/b484495ac6117100ee49a22c4b38b2b6 to your computer and use it in GitHub Desktop.
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* This is a schema for responses in the JSON API format. For more, see http://jsonapi.org
*/
export type JsonApiSchema = (Success | Failure | Info);
/**
* The document's "primary data" is a representation of the resource or collection of resources targeted by a request.
*/
export type Data = (Resource | Resource[] | null);
/**
* A link **MUST** be represented as either: a string containing the link's URL or a link object.
*/
export type Link = (string | {
/**
* A string containing the link's URL.
*/
href: string;
meta?: Meta;
[k: string]: any;
});
export interface Success {
data: Data;
/**
* To reduce the number of HTTP requests, servers **MAY** allow responses that include related resources along with the requested primary resources. Such responses are called "compound documents".
*/
included?: Resource[];
meta?: Meta;
/**
* Link members related to the primary data.
*/
links?: (Links & Pagination);
jsonapi?: Jsonapi;
}
/**
* "Resource objects" appear in a JSON API document to represent resources.
*/
export interface Resource {
type: string;
id: string;
attributes?: Attributes;
relationships?: Relationships;
links?: Links;
meta?: Meta;
}
/**
* Members of the attributes object ("attributes") represent information about the resource object in which it's defined.
*/
export interface Attributes {
}
/**
* Members of the relationships object ("relationships") represent references from the resource object in which it's defined to other resource objects.
*/
export interface Relationships {
}
export interface Links {
[k: string]: Link;
}
/**
* Non-standard meta-information that can not be represented as an attribute or relationship.
*/
export interface Meta {
[k: string]: any;
}
export interface Pagination {
/**
* The first page of data
*/
first?: (string | null);
/**
* The last page of data
*/
last?: (string | null);
/**
* The previous page of data
*/
prev?: (string | null);
/**
* The next page of data
*/
next?: (string | null);
[k: string]: any;
}
/**
* An object describing the server's implementation
*/
export interface Jsonapi {
version?: string;
meta?: Meta;
}
export interface Failure {
errors: Error[];
meta?: Meta;
jsonapi?: Jsonapi;
links?: Links;
}
export interface Info {
meta: Meta;
links?: Links;
jsonapi?: Jsonapi;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment