////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

== Custom Naming Conventions

The names used to describe entities is configurable through the use of an link:{api}/org/grails/gorm/graphql/entity/GraphQLEntityNamingConvention.html[GraphQLEntityNamingConvention].

The class controls the name of the default operations and the names of the GraphQL types built from the GORM entities.

=== Standalone

The naming convention is a property of the type manager. If you are supplying a custom type manager to the schema, set the property on it directly. If you are relying on the default type manager, do the following after creating the schema, but before calling generate:

[source,groovy]
----
import org.grails.gorm.graphql.Schema

Schema schema = ...
schema.namingConvention = new MyNamingConvention()
----

=== Grails

To override the naming convention in a Grails application, register a bean with the name "graphQLEntityNamingConvention" that extends link:{api}/org/grails/gorm/graphql/entity/GraphQLEntityNamingConvention.html[GraphQLEntityNamingConvention].

[source,groovy]
.resources.groovy
----
graphQLEntityNamingConvention(MyNamingConvention)
----