[schema] Cleanup infer/dontInfer #18873
Replies: 2 comments
-
Question about:
This is for when users/plugins declare type using |
Beta Was this translation helpful? Give feedback.
-
Yes, they should do
I think it's fine to have defaults, so |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently we have non-symmetrical relation between directives
@infer
/@dontInfer
and extensionsinfer
.@infer
maps toinfer: true
, while@dontInfer
maps toinfer: false
. This not only breaks the convention that directives directly map onto extensions, but also the convention that extension values are objects.I propose the following changes:
@infer
-mode
. It accepts an enum ofENABLED
|DISABLED
|DEPRECATED
@infer
default becomes@infer(mode: 'ENABLED')
and{ infer: { mode: 'ENABLED' } }
.@dontInfer
stays the same and becomes{ infer: { mode: 'DISABLED
} }`.infer: true
andinfer: false
get converted to corresponding object and trigger a deprecation warning.DEPRECATED
for infer raises a warning if declared schema doesn't match inferred schema. It is to be used, for example, by core team when we define core types likeFile
orImageSharp
.CC @vladar @stefanprobst @ChristopherBiscardi
Beta Was this translation helpful? Give feedback.
All reactions