Refreshing a GraphQL Descriptor
Once you create a GraphQL descriptor, you can refresh it with a new or updated GraphQL schema.
Incase there are some changes in the GraphQL schema, for example, data types or fields are modified or there are some changes in the operations, then instead of redefining a new GraphQL descriptor you can refresh the existing GraphQL descriptor.
To refresh a GraphQL descriptor
1. In the Package Navigator view, right click on the GraphQL descriptor.
2. Select Refresh GraphQL Descriptor.
3. Click OK to continue.
4. In the Refresh GraphQL Descriptor dialog box, click Browse to navigate and select the new GraphQL schema.
5. Click Finish.
Designer modifies the GraphQL descriptor based on the new schema and displays the details in the GraphQL descriptor editor.
6. Click File > Save to save the properties.
How Integration Server refreshes the GraphQL descriptor
Once you refresh the GraphQL descriptor in Designer, Integration Server performs the following steps:
1. Takes backup of the GraphQL descriptor, all the resolver services, and all the document types.
2. Deletes all the document types from <DESCRIPTOR>_/types folder.
3. If a GraphQL type is removed from the new schema then Integration Server deletes all the resolver services for that type.
4. If a field is removed from the new schema and a resolver service already exists for that field then Integration Server deletes that resolver service.
5. If some fields and types from the old schema are preserved in new schema then the Integration Server does not delete the resolver services for those fields or types. Integration Server only updates the input and output signatures in the existing resolver services. Once the descriptor is refreshed successfully, you need to change the operation logic in the resolver services according to the new input or output signature.
6. Creates the document types for all the new GraphQL types.
7. Creates the resolver services for all the new fields.
8. If there are no errors during refresh operation, then Integration Server deletes the backup files before completing the operation.
9. If there is any error during refresh then Integration Server restores the descriptor from the backed up files.
Following are the limitations while refreshing the GraphQL descriptor:
While refreshing the descriptor,
Integration Server updates or deletes the document types present in folder
<DESCRIPTOR>_/types. If the folder structure is moved or renamed then
Integration Server does not update or delete the existing document types, instead
Integration Server creates new folder structure as
<DESCRIPTOR>_/types, and all the document types are created in this new folder structure.
While refreshing the descriptor,
Integration Server updates or deletes the resolver services present in folder
<DESCRIPTOR>_/resolvers/<TYPE>. If the folder structure is moved or renamed then
Integration Server does not update or delete the existing resolvers services, instead
Integration Server creates a new folder structure as
<DESCRIPTOR>_/resolvers/<TYPE> and all the resolver services are created in this new folder structure.