deep-foundation / deep-foundation/deeplinks

Throw proper error if there is no Value link for type

Open
#82 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
13
Forks
8
PR merge metrics
No merged PRs in 30d

Description

When we create a type-link:
```js
const {data: [{id: newTypeLinkId}]} = await deep.insert({
type_id: await deep.id("@deep-foundation/core", "Type")
});
```
And do not create a Value link from a Type link to a (String)|(Number)|(Object)|(File) link:
```js
// This code should not be executed to reproduce a problem
await deep.insert({
type_id: await deep.id("@deep-foundation/core", "Value"),
from_id: newTypeLinkId,
to_id: await deep.id("@deep-foundation/core", "Number")
})
```
We get error
> ApolloError: field "link_id" not found in type: 'links_insert_input'

But should get something like
> A link with type_id ["@deep-foundation/core", "Type"] must be created from typeLinkId to (String)|(Number)|(Object)|(File)LinkId to update a value of a link

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown deep.insert and deep.id calls, first inspecting the error path that handles a Type link without a Value link. Compare the current ApolloError with the requested message; done means the missing-link case reports the required Type and value-link details instead of the schema error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.