Skip to content

Commit

Permalink
feat: support graphQL annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kdamball committed Dec 20, 2023
1 parent 2ae3bdc commit 15462dd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/43-assign-field-annotations.js
@@ -1,4 +1,17 @@
module.exports = function (migration) {
const annotatedContentType = migration.editContentType('annotated')
annotatedContentType.editField('sources').setAnnotations(['Contentful:AggregateComponent'])
annotatedContentType.editField('title').setAnnotations([
{
sys: {
type: 'Link',
linkType: 'Annotation',
id: 'Contentful:GraphQLFieldResolver'
},
parameters: {
appFunctionId: '123',
appDefinitionId: '456'
}
}
])
}
22 changes: 22 additions & 0 deletions src/lib/interfaces/annotation.ts
Expand Up @@ -94,6 +94,28 @@ export const availableAnnotations = {
]
}
]
}),
'Contentful:GraphQLFieldResolver': new Annotation({
id: 'Contentful:GraphQLFieldResolver',
targets: [
{
type: 'ContentTypeField',
accept: [
{
type: 'Symbol'
},
{
type: 'Array',
items: {
type: 'Symbol'
}
},
{
type: 'Object'
}
]
}
]
})
}

Expand Down
13 changes: 13 additions & 0 deletions test/integration/migration.spec.js
Expand Up @@ -1217,6 +1217,19 @@ describe('the migration', function () {
linkType: 'Annotation'
}
}
],
title: [
{
sys: {
type: 'Link',
linkType: 'Annotation',
id: 'Contentful:GraphQLFieldResolver'
},
parameters: {
appFunctionId: '123',
appDefinitionId: '456'
}
}
]
}
}
Expand Down

0 comments on commit 15462dd

Please sign in to comment.