Skip to content

Instantly share code, notes, and snippets.

@dwickern
Created August 28, 2017 19:18
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/8c784e665ef05904d88a1723ca0bbbdc to your computer and use it in GitHub Desktop.
Save dwickern/8c784e665ef05904d88a1723ca0bbbdc to your computer and use it in GitHub Desktop.
JSON API schema (generated by NJsonSchema using typeStyle=interface)
/* tslint:disable */
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v11.3.5.0 (NJsonSchema v9.4.5.0) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming
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?: any;
/** Link members related to the primary data. */
links?: Links;
jsonapi?: Jsonapi;
}
export interface Failure {
errors: ErrorDto[];
meta?: any;
jsonapi?: Jsonapi;
links?: { [key: string] : Link; };
}
export interface Info {
meta: any;
links?: { [key: string] : Link; };
jsonapi?: Jsonapi;
}
/** The document's "primary data" is a representation of the resource or collection of resources targeted by a request. */
export interface Data {
}
/** "Resource objects" appear in a JSON API document to represent resources. */
export interface Resource {
type: string;
id: string;
attributes?: { [key: string] : any; };
relationships?: { [key: string] : Anonymous2; };
links?: { [key: string] : Link; };
meta?: any;
}
/** A resource object **MAY** contain references to other resource objects ("relationships"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object. */
export interface RelationshipLinks {
/** A `self` member, whose value is a URL for the relationship itself (a "relationship URL"). This URL allows the client to directly manipulate the relationship. For example, it would allow a client to remove an `author` from an `article` without deleting the people resource itself. */
self?: Link;
related?: Link;
}
/** A link **MUST** be represented as either: a string containing the link's URL or a link object. */
export interface Link {
}
/** References to other resource objects in a to-one ("relationship"). Relationships can be specified by including a member in a resource's links object. */
export interface RelationshipToOne {
}
/** The "type" and "id" to non-empty members. */
export interface Linkage {
type: string;
id: string;
meta?: any;
}
export interface Pagination {
/** The first page of data */
first?: string;
/** The last page of data */
last?: string;
/** The previous page of data */
prev?: string;
/** The next page of data */
next?: string;
}
/** An object describing the server's implementation */
export interface Jsonapi {
version?: string;
meta?: any;
}
export interface ErrorDto {
/** A unique identifier for this particular occurrence of the problem. */
id?: string;
links?: { [key: string] : Link; };
/** The HTTP status code applicable to this problem, expressed as a string value. */
status?: string;
/** An application-specific error code, expressed as a string value. */
code?: string;
/** A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization. */
title?: string;
/** A human-readable explanation specific to this occurrence of the problem. */
detail?: string;
source?: Source;
meta?: any;
}
/** This is a schema for responses in the JSON API format. For more, see http://jsonapi.org */
export interface Anonymous {
}
export interface Links {
/** The first page of data */
first?: string;
/** The last page of data */
last?: string;
/** The previous page of data */
prev?: string;
/** The next page of data */
next?: string;
[key: string]: Link | any;
}
export interface Anonymous2 {
links?: RelationshipLinks;
/** Member, whose value represents "resource linkage". */
data?: RelationshipToOne;
meta?: any;
}
export interface Source {
/** A JSON Pointer [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 query parameter caused the error. */
parameter?: string;
}
function throwException(message: string, status: number, response: string, result?: any): any {
if(result !== null && result !== undefined)
throw result;
else
throw new SwaggerException(message, status, response, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment