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

Behavior for @inaccessible and @internal in combination with unions, interfaces and enum values. #136

Open
michaelstaib opened this issue Jan 16, 2025 · 3 comments

Comments

@michaelstaib
Copy link
Member

Example 1

union SearchResult = User | Group

type User @inaccessible { id: ID! }


type Query {
    search(text: String!): SearchResult
}
enum SearchResult
{
    FOUND
    NOT_FOUND @inaccessible
}

type Query {
    search(text: String!): SearchResult
}

what does apollo do in this case?

a) Composition error as we could not have runtime errors (when user is returned)
b) Composition warning and returning null at runtime
c) No composition error and returning null at runtime
d) No composition error and throwing error at runtime (edited)

@dariuszkuc
Copy link

Current Apollo behavior

  • example 1

    • API schema results in union SearchResult = Group (i.e. User is not available in the schema)
    • no composition warnings
    • if subgraph were to return User that would be a runtime error
  • example 2

    • API schema exposes only enum SearchResult { FOUND }
    • no composition warnings
    • returning NOT_FOUND results in runtime error

@dariuszkuc
Copy link

Option e - composition warning + runtime error

@glen-84
Copy link
Contributor

glen-84 commented Jan 26, 2025

Should we close this, and open a separate issue about adding a validation rule?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants