Skip to content

Commit

Permalink
Fix type ResourceObject.
Browse files Browse the repository at this point in the history
Missing "links".
  • Loading branch information
masterT committed Feb 25, 2022
1 parent 064c918 commit b62474f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/JsonApi/Specification.TypeGuards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ export function isResourceObject(obj: any, _argumentName?: string): obj is Resou
(typeof obj.attributes === "undefined" ||
isAttributesObject(obj.attributes) as boolean) &&
(typeof obj.relationships === "undefined" ||
isRelationshipsObject(obj.relationships) as boolean)
isRelationshipsObject(obj.relationships) as boolean) &&
(typeof obj.links === "undefined" ||
isLinkObject(obj.links) as boolean)
)
}

Expand Down
6 changes: 5 additions & 1 deletion src/JsonApi/Specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,20 @@ export type RelationshipsObject = {
* },
* "data": { "type": "people", "id": "9" }
* }
* },
* "links": {
* "self": "http://example.com/articles/1"
* }
* }
* @see {@link https://jsonapi.org/format/#document-links}
* @see {@link https://jsonapi.org/format/#document-resource-objects}
* @see {@link isResourceObject} ts-auto-guard:type-guard
*/
export type ResourceObject = {
id: string;
type: string;
attributes?: AttributesObject;
relationships?: RelationshipsObject;
links?: LinkObject;
};

/**
Expand Down

0 comments on commit b62474f

Please sign in to comment.