Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 6e5b8bc

Browse files
docs: add documentation on aliased scalars
1 parent a3ef4f2 commit 6e5b8bc

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ and join the team!
1919
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
2020
**Table of Contents**
2121

22-
- [Quick start](#quick-start)
23-
- [Using Gradle](#using-gradle)
24-
- [Using Maven](#using-maven)
25-
- [Documentation](#documentation)
26-
- [Requirements and Downloads](#requirements-and-downloads)
27-
- [Snapshots](#snapshots)
22+
- [Quick start](#quick-start)
23+
- [Using Gradle](#using-gradle)
24+
- [Using Maven](#using-maven)
25+
- [Documentation](#documentation)
26+
- [Requirements and Downloads](#requirements-and-downloads)
27+
- [Snapshots](#snapshots)
2828
- [Enable GraphQL Servlet](#enable-graphql-servlet)
2929
- [Enable Graph*i*QL](#enable-graphiql)
3030
- [Enable Altair](#enable-altair)
@@ -35,8 +35,8 @@ and join the team!
3535
- [Customizing GraphQL Playground](#customizing-graphql-playground)
3636
- [Tabs](#tabs)
3737
- [Enable GraphQL Voyager](#enable-graphql-voyager)
38-
- [Basic settings](#graphql-voyager-basic-settings)
39-
- [CDN](#graphql-voyager-cdn)
38+
- [GraphQL Voyager Basic settings](#graphql-voyager-basic-settings)
39+
- [GraphQL Voyager CDN](#graphql-voyager-cdn)
4040
- [Customizing GraphQL Voyager](#customizing-graphql-voyager)
4141
- [Supported GraphQL-Java Libraries](#supported-graphql-java-libraries)
4242
- [GraphQL Java Tools](#graphql-java-tools)
@@ -47,11 +47,11 @@ and join the team!
4747
- [Custom scalars and type functions](#custom-scalars-and-type-functions)
4848
- [Custom Relay and GraphQL Annotation Processor](#custom-relay-and-graphql-annotation-processor)
4949
- [Extended scalars](#extended-scalars)
50+
- [Aliased scalars](#aliased-scalars)
5051
- [Tracing and Metrics](#tracing-and-metrics)
5152
- [Usage](#usage)
52-
- [FAQs](#faqs)
53-
- [WARNING: NoClassDefFoundError when using GraphQL Java Tools > 5.4.x](#warning-noclassdeffounderror-when-using-graphql-java-tools--54x)
54-
53+
- [FAQs](#faqs)
54+
- [WARNING: NoClassDefFoundError when using GraphQL Java Tools > 5.4.x](#warning-noclassdeffounderror-when-using-graphql-java-tools--54x)
5555
- [Contributions](#contributions)
5656
- [Licenses](#licenses)
5757

@@ -560,6 +560,34 @@ scalar BigDecimal
560560
scalar Date
561561
```
562562

563+
## Aliased scalars
564+
565+
*Requires version 12.0.0 or greater*
566+
567+
The starter also supports [aliased scalars](https://github.com/graphql-java/graphql-java-extended-scalars#alias-scalars).
568+
You can define aliases for any standard or extended scalar, as shown in the example below. Note that
569+
the original extended scalar (`BigDecimal`) will *not* be available. You have to use
570+
`graphql.extended-scalars` property to declare it.
571+
572+
```yaml
573+
graphql:
574+
aliased-scalars:
575+
BigDecimal: Number, Decimal
576+
String: Text
577+
```
578+
579+
When using the [GraphQL Java Tools](#graphql-java-tools) integration, the aliased scalars must also be
580+
declared in the GraphQL Schema:
581+
582+
```graphql
583+
scalar Number
584+
scalar Decimal
585+
scalar Text
586+
```
587+
588+
**Note**: *Custom scalar beans cannot be aliased this way. If you need to alias them, you have to
589+
manually declare the aliased scalar bean.*
590+
563591
# Tracing and Metrics
564592

565593
[Apollo style tracing](https://github.com/apollographql/apollo-tracing) along with two levels of

0 commit comments

Comments
 (0)