graphql / graphql/graphql-spec

Glossary request: inner vs unwrapped types

Open
#831 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

In the GraphQL spec we refer to these terms:

1. unwrapped nullable type
2. unwrapped item type
3. unwrapped type
4. inner item type
5. inner type

They seem to have subtly different meanings:

- `inner type` - for a non-null or list variant, this is the type that the non-null or list wraps (which may itself be a non-null or list).
- `inner item type` - as `inner type` but only applies to list variants
- `unwrapped type` - I _believe_ this means the same as `inner type`, though I could be wrong and it might mean the underlying named type. This term is only used in https://spec.graphql.org/draft/#sec-Input-and-Output-Types and both interpretations will get you the same result (through slightly different paths).
- `unwrapped nullable type` - for a non-null variant, this means the inner type; for all other types it is the unchanged type
- `unwrapped item type` - for a list variant, this means the inner type; for all other types it is the unchanged type

I, personally, think it would be better to just use `inner type` throughout and make the "if it is a non-null variant then the inner type otherwise the type" meaning explicit. However, a step up over the current situation would be to have a glossary explaining these terms.

If there's more subtlety to the differences between these terms I'd love to understand it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.