Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One sided primary relations are not queryable #2830

Closed
AndrewSisley opened this issue Jul 11, 2024 · 1 comment · Fixed by #3021
Closed

One sided primary relations are not queryable #2830

AndrewSisley opened this issue Jul 11, 2024 · 1 comment · Fixed by #3021
Assignees
Labels
area/query Related to the query component area/schema Related to the schema system bug Something isn't working feature New feature or request
Milestone

Comments

@AndrewSisley
Copy link
Contributor

Found by David, e.g.:
######### Schema

type TypeA {
  test: String
}

type TypeB {
  test: String
  ref: TypeA @primary
}

######### Create Types

mutation create_typeA {
  create_TypeA(input: { test: "1" }) {
    _docID
  } # bae-31fc529a-4edb-54e3-bf44-439a6570daf4
}
mutation create_typeB {
  create_TypeB(
    input: { test: "2", ref_id: "bae-31fc529a-4edb-54e3-bf44-439a6570daf4" }
  ) {
    _docID
  } # bae-b7a8d5ee-375d-5d90-90a6-f518fed888b2
}

######### Query

query { TypeB { test ref { test } } }

######### Result

{
  "data": null,
  "errors": [
    "The given field does not exist. Name: ref"
  ]
}

The schema is valid (although I'm not sure we test with the primary directive), as one-sided relations are fairly new it might be that we never actually test querying them and have relied on introspection/collection-description tests.

@AndrewSisley AndrewSisley added bug Something isn't working area/query Related to the query component area/schema Related to the schema system labels Jul 11, 2024
@AndrewSisley AndrewSisley self-assigned this Jul 17, 2024
@AndrewSisley AndrewSisley added this to the DefraDB v0.13 milestone Jul 17, 2024
@AndrewSisley
Copy link
Contributor Author

This was caused by #2529

The PR description states:

This allows for one-sided relations to be defined via PatchSchema. There is no way atm to create them using an SDL, but we could add a directive or something at somepoint if we want.

Suggesting that SDL support for this was never added, it is likely that the validation that prevented one-sided SDL docs was accidentally removed (likely whilst forgetting that this limitation exists).

I might just add SDL support for this in this issue, instead of adding validation. It might be about the same effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/query Related to the query component area/schema Related to the schema system bug Something isn't working feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant