This PR adds a new rewriter type called ScalarFieldToObjectFieldRewriter. This rewriter allows rewriting a field that's a scalar, like title: 'blah', to an object with a single nested scalar, like { title: { text: 'blah' } }.
For example, this would allow transitioning from a schema like:
type Article {
title: String!
...
}
to
type ArticleTitle {
text: String!
localizedText: string
}
type Article {
title: ArticleTitle!
...
}
The rewriter to do this would look like:
new ScalarFieldToObjectFieldRewriter({
fieldName: 'title',
objectFieldName: 'text'
})
This PR adds a new rewriter type called
ScalarFieldToObjectFieldRewriter
. This rewriter allows rewriting a field that's a scalar, liketitle: 'blah'
, to an object with a single nested scalar, like{ title: { text: 'blah' } }
.For example, this would allow transitioning from a schema like:
to
The rewriter to do this would look like:
Then, when an old query arrives requesting:
this will be rewritten to