Skip to main content

GraphQL Content Delivery- type name collision helper

Release date: 4th October 2023

This release features a new API to support the management of graphs for the GraphQL Content Delivery API.

The GraphQL type name collision helper allows developers to validate if a graph for a specific hub has been successfully published or not. Where it has not been successful, it allows the user to retrieve details of the errors that caused the failure. When the failure is due to a type name collision, it allows the user to retrieve a list of collisions they can address before attempting to generate a new version of the graph for that hub.

note

The GraphQL type name collision helper is accessed through a diagnostic HTTP API, which can be used with any API tool such as Postman or Insomnia.

The GraphQL type name collision helper also aids with identifying all hubs that users have access to, including the hub IDs and other information.

Using the GraphQL type name collision helper
Link copied!

If you are unable to view your hub’s graph, or the graph has not updated after a recent change to the content type schemas, the GraphQL type name collision helper allows you to confirm if the last attempt to generate the graph was successful or not. If it was not, it allows you to retrieve a list of errors that caused the failure.

The following example shows how the GraphQL type name collision helper can be used. In this example we use Insomnia to interact with the API.

Identifying type name collisions with the helper
Link copied!

As shown in the screenshot below, we can see that our issue is a type name collision involving a banner and slot schema that have been given similar names.

We must include additional parameters to get a specific response.

Example response
Link copied!

{
"_embedded": {
"graphql-publishing-jobs": [
{
"id": "6512b090d7a5c99cc9a8bd86",
"createdDate": "2023-09-26T10:21:03.967Z",
"status": {
"code": "FAILED_TO_PUBLISH"
},
"compilationJobId": "6512b090d7a5c99cc9a8bd85",
"compilationSummary": {
"status": "FAILURE",
"errors": [
{
"level": "FATAL",
"detail": {
"message": "A type with a duplicate name exists.",
"generatedName": "TutorialBanner",
"conflictingTypes": [
"https://schema-examples.com/tutorial-banner#",
"https://schema-examples.com/tutorial-Banner#"
]
},
"type": "GRAPHQL_DUPLICATE_TYPE"
}
]
}
}
]
},
"_links": {
"self": {
"href": "https://api.amplience.net/v2/content/hubs/6452d5854e3436787a061b53/graphql-publishing-jobs?compilationSummary=true"
}
}
}

Solving a type name collision
Link copied!

To solve this, we archive both schemas and create new ones that do not have similar names. When we query our new schema in the GraphQL playground we now get a response showing that the graph has been successfully built.

For more information on type name collisions and the different ways to fix them, see the GraphQL Content Delivery API overview.

Our graph has been created successfully.

Using the GraphQL type name collision helper, we also get a response informing us that building the graph was successful.

Now we have a successful response from the GraphQL type name collision helper.

GraphQL type name collision helper

GraphQL Content Delivery API overview