I have created a Python Flask server with Apollo GraphQL using Ariadne. My GraphQL schema should have attributes names in camelCase. However, it seems like, it is must for my GraphQL resolver to return attributes names in snake_case or else the response doesn't get resolved.
Here is my GraphQL schema definition:
type Asset {
assetId: ID!
accountId: Int
version
}
type Query {
getAssets() : [Asset]
}
My resolver function:
@convert_kwargs_to_snake_case
def get_commercial_asset_resolver(obj, info):
"""Resolver function to fetch list of assets"""
assets = runquery.run_query_for_assets()
return assets
With decorator @convert_kwargs_to_snake_case in place, one attribute gets mapped successfully in the GraphQL response i.e. version as snake_case and camelCase for it is same.
However, if I remove @convert_kwargs_to_snake_case from my resolver, none of the attributes from my result set gets mapped to the GraphQL response.
Is it possible to user camelCase attributes with Ariadne in Python? By looking at Ariadne documentation it seems like it's not. Looking for suggestions.