Skip to content

Commit 233c670

Browse files
committed
replace md tables with html, so we can control the code blocks
1 parent da511cf commit 233c670

File tree

1 file changed

+240
-53
lines changed

1 file changed

+240
-53
lines changed

README.md

Lines changed: 240 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,20 @@ type Something {
8181

8282
## Alias Scalars
8383

84-
| Scalar Name | Scalar Specification | Description |
85-
| --------------- | ---------------------------------------------- | --------------------------------------------------------------------------------- |
86-
| `AliasedScalar` | <pre lang="graphql">scalar AliasedScalar</pre> | You can create aliases for existing scalars to add more semantic meaning to them. |
84+
<table>
85+
<tr>
86+
<td>Scalar Name</td>
87+
<td>Scalar Specification</td>
88+
<td>Description</td>
89+
</tr>
90+
<tr>
91+
<td><code>AliasedScalar</code></td>
92+
<td><pre lang="graphql">
93+
scalar AliasedScalar
94+
</pre></td>
95+
<td>You can create aliases for existing scalars to add more semantic meaning to them.</td>
96+
</tr>
97+
</table>
8798

8899
For example a link to a social media post could be representing by a `String` but the name `SocialMediaLink` is a
89100
more semantically meaningful name for that scalar type.
@@ -107,12 +118,49 @@ type Customer {
107118

108119
## Date & Time Scalars
109120

110-
| Scalar Name | Scalar Definition | Description |
111-
| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
112-
| `DateTime` | <pre lang="graphql">scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html")</pre> | An RFC-3339 compliant date time scalar that accepts string values like `1996-12-19T16:39:57-08:00` and produces `java.time.OffsetDateTime` objects at runtime. |
113-
| `Time` | <pre lang="graphql">scalar Time @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")</pre> | An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime |
114-
| `LocalTime` | <pre lang="graphql">scalar LocalTime</pre> | 24-hour clock time string in the format `hh:mm:ss.sss` or `hh:mm:ss` if partial seconds is zero and produces `java.time.LocalTime` objects at runtime. |
115-
| `Date` | <pre lang="graphql">scalar Date @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")</pre> | An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime |
121+
<table>
122+
<tr>
123+
<td>Scalar Name</td>
124+
<td>Scalar Specification</td>
125+
<td>Description</td>
126+
</tr>
127+
<tr>
128+
<td><code>DateTime</code></td>
129+
<td><pre lang="graphql">
130+
scalar DateTime
131+
@specifiedBy(url:
132+
"https://scalars.graphql.org/andimarek/date-time.html"
133+
)
134+
</pre></td>
135+
<td>A RFC-3339 compliant date time scalar that accepts string values like <code>1996-12-19T16:39:57-08:00</code> and produces <code>java.time.OffsetDateTime</code> objects at runtime.</td>
136+
</tr>
137+
<tr>
138+
<td><code>Date</code></td>
139+
<td><pre lang="graphql">
140+
scalar Date
141+
@specifiedBy(url:
142+
["https://tools.ietf.org/html/rfc3339](https://tools.ietf.org/html/rfc3339)"
143+
)</pre></td>
144+
<td>A RFC-3339 compliant date scalar that accepts string values like <code>1996-12-19</code> and produces <code>java.time.LocalDate</code> objects at runtime.</td>
145+
</tr>
146+
<tr>
147+
<td><code>Time</code></td>
148+
<td><pre lang="graphql">
149+
scalar Time
150+
@specifiedBy(url:
151+
"https://tools.ietf.org/html/rfc3339"
152+
)
153+
</pre></td>
154+
<td>A RFC-3339 compliant time scalar that accepts string values like <code>16:39:57-08:00</code> and produces <code>java.time.OffsetTime</code> objects at runtime.</td>
155+
</tr>
156+
<tr>
157+
<td><code>LocalTime</code></td>
158+
<td><pre lang="graphql">
159+
scalar LocalTime
160+
</pre></td>
161+
<td>24-hour clock time string in the format <code>hh:mm:ss.sss</code> or <code>hh:mm:ss</code> if partial seconds is zero and produces <code>java.time.LocalTime</code> objects at runtime.</td>
162+
</tr>
163+
</table>
116164

117165
An example declaration in SDL might be:
118166

@@ -141,22 +189,73 @@ query {
141189

142190
## ID Scalars
143191

144-
| Scalar Name | Scalar Definition | Description |
145-
| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146-
| `UUID` | <pre lang="graphql">scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")</pre> | A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime. |
192+
<table>
193+
<tr>
194+
<td>Scalar Name</td>
195+
<td>Scalar Specification</td>
196+
<td>Description</td>
197+
</tr>
198+
<tr>
199+
<td><code>UUID</code></td>
200+
<td><pre lang="graphql">
201+
scalar UUID
202+
@specifiedBy(url:
203+
"https://tools.ietf.org/html/rfc4122"
204+
)
205+
</pre></td>
206+
<td>A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime.</td>
207+
</tr>
208+
</table>
147209

148210
## Numeric Scalars
149211

150-
| Scalar Name | Scalar Definition | Description |
151-
| ------------------ | ------------------------------------------------- | ------------------------------------------------------------- |
152-
| `PositiveInt` | <pre lang="graphql">scalar PositiveInt</pre> | An `Int` scalar that MUST be greater than zero. |
153-
| `NegativeInt` | <pre lang="graphql">scalar NegativeInt</pre> | An `Int` scalar that MUST be less than zero. |
154-
| `NonPositiveInt` | <pre lang="graphql">scalar NonPositiveInt</pre> | An `Int` scalar that MUST be less than or equal to zero. |
155-
| `NonNegativeInt` | <pre lang="graphql">scalar NonNegativeInt</pre> | An `Int` scalar that MUST be greater than or equal to zero. |
156-
| `PositiveFloat` | <pre lang="graphql">scalar PositiveFloat</pre> | An `Float` scalar that MUST be greater than zero. |
157-
| `NegativeFloat` | <pre lang="graphql">scalar NegativeFloat</pre> | An `Float` scalar that MUST be less than zero. |
158-
| `NonPositiveFloat` | <pre lang="graphql">scalar NonPositiveFloat</pre> | An `Float` scalar that MUST be less than or equal to zero. |
159-
| `NonNegativeFloat` | <pre lang="graphql">scalar NonNegativeFloat</pre> | An `Float` scalar that MUST be greater than or equal to zero. |
212+
<table>
213+
<tr>
214+
<td>Scalar Name</td>
215+
<td>Scalar Specification</td>
216+
<td>Description</td>
217+
</tr>
218+
<tr>
219+
<td><code>PositiveInt</code></td>
220+
<td><pre lang="graphql">scalar PositiveInt</pre></td>
221+
<td>An <code>Int</code> scalar that MUST be greater than zero.</td>
222+
</tr>
223+
<tr>
224+
<td><code>NegativeInt</code></td>
225+
<td><pre lang="graphql">scalar NegativeInt</pre></td>
226+
<td>An <code>Int</code> scalar that MUST be less than zero.</td>
227+
</tr>
228+
<tr>
229+
<td><code>NonPositiveInt</code></td>
230+
<td><pre lang="graphql">scalar NonPositiveInt</pre></td>
231+
<td>An <code>Int</code> scalar that MUST be less than or equal to zero.</td>
232+
</tr>
233+
<tr>
234+
<td><code>NonNegativeInt</code></td>
235+
<td><pre lang="graphql">scalar NonNegativeInt</pre></td>
236+
<td>An <code>Int</code> scalar that MUST be greater than or equal to zero.</td>
237+
</tr>
238+
<tr>
239+
<td><code>PositiveFloat</code></td>
240+
<td><pre lang="graphql">scalar PositiveFloat</pre></td>
241+
<td>An <code>Float</code> scalar that MUST be greater than zero.</td>
242+
</tr>
243+
<tr>
244+
<td><code>NegativeFloat</code></td>
245+
<td><pre lang="graphql">scalar NegativeFloat</pre></td>
246+
<td>An <code>Float</code> scalar that MUST be less than zero.</td>
247+
</tr>
248+
<tr>
249+
<td><code>NonPositiveFloat</code></td>
250+
<td><pre lang="graphql">scalar NonPositiveFloat</pre></td>
251+
<td>An <code>Float</code> scalar that MUST be less than or equal to zero.</td>
252+
</tr>
253+
<tr>
254+
<td><code>NonNegativeFloat</code></td>
255+
<td><pre lang="graphql">scalar NonNegativeFloat</pre></td>
256+
<td>An <code>Float</code> scalar that MUST be greater than or equal to zero.</td>
257+
</tr>
258+
</table>
160259

161260
The numeric scalars are derivations of the standard GraphQL `Int` and `Float` scalars that enforce range limits.
162261

@@ -189,20 +288,63 @@ query {
189288

190289
## Java Primitives
191290

192-
| Scalar Name | Scalar Specification | Description |
193-
| ------------------- | -------------------------------------------------- | ------------------------------------------------ |
194-
| `GraphQLLong` | <pre lang="graphql">scalar GraphQLLong</pre> | A scalar which represents `java.lang.Long` |
195-
| `GraphQLShort` | <pre lang="graphql">scalar GraphQLShort</pre> | A scalar which represents `java.lang.Short` |
196-
| `GraphQLByte` | <pre lang="graphql">scalar GraphQLByte</pre> | A scalar which represents `java.lang.Byte` |
197-
| `GraphQLBigDecimal` | <pre lang="graphql">scalar GraphQLBigDecimal</pre> | A scalar which represents `java.math.BigDecimal` |
198-
| `GraphQLBigInteger` | <pre lang="graphql">scalar GraphQLBigInteger</pre> | A scalar which represents `java.math.BigInteger` |
199-
| `GraphQLChar` | <pre lang="graphql">scalar GraphQLChar</pre> | A scalar which represents `java.lang.Character` |
291+
<table>
292+
<tr>
293+
<td>Scalar Name</td>
294+
<td>Scalar Specification</td>
295+
<td>Description</td>
296+
</tr>
297+
<tr>
298+
<td><code>GraphQLLong</code></td>
299+
<td><pre lang="graphql">scalar GraphQLLong</pre></td>
300+
<td>A scalar which represents <code>java.lang.Long<code></td>
301+
</tr>
302+
<tr>
303+
<td><code>GraphQLShort</code></td>
304+
<td><pre lang="graphql">scalar GraphQLShort</pre></td>
305+
<td>A scalar which represents <code>java.lang.Short<code></td>
306+
</tr>
307+
<tr>
308+
<td><code>GraphQLByte</code></td>
309+
<td><pre lang="graphql">scalar GraphQLByte</pre></td>
310+
<td>A scalar which represents <code>java.lang.Byte<code></td>
311+
</tr>
312+
<tr>
313+
<td><code>GraphQLBigDecimal</code></td>
314+
<td><pre lang="graphql">scalar GraphQLBigDecimal</pre></td>
315+
<td>A scalar which represents <code>java.lang.BigDecimal<code></td>
316+
</tr>
317+
<tr>
318+
<td><code>GraphQLBigInteger</code></td>
319+
<td><pre lang="graphql">scalar GraphQLBigInteger</pre></td>
320+
<td>A scalar which represents <code>java.lang.BigInteger<code></td>
321+
</tr>
322+
<tr>
323+
<td><code>GraphQLChar</code></td>
324+
<td><pre lang="graphql">scalar GraphQLChar</pre></td>
325+
<td>A scalar which represents <code>java.lang.Character<code></td>
326+
</tr>
327+
</table>
200328

201329
## Locale Scalar
202330

203-
| Scalar Name | Scalar Specification | Description |
204-
| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
205-
| `Locale` | <pre lang="graphql">scalar Locale @specifiedBy(url: "https://tools.ietf.org/html/bcp47")</pre> | The Locale scalar handles [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tags via the JDK method [Locale.forLanguageTag](<https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag(java.lang.String)>) |
331+
<table>
332+
<tr>
333+
<td>Scalar Name</td>
334+
<td>Scalar Specification</td>
335+
<td>Description</td>
336+
</tr>
337+
<tr>
338+
<td><code>Locale</code></td>
339+
<td><pre lang="graphql">
340+
scalar Locale
341+
@specifiedBy(url:
342+
"https://tools.ietf.org/html/bcp47"
343+
)
344+
</pre></td>
345+
<td>The Locale scalar handles <a href="https://tools.ietf.org/html/bcp47">IETF BCP 47</a> language tags via the JDK method <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag(java.lang.String)">Locale.forLanguageTag</a>.</td>
346+
</tr>
347+
</table>
206348

207349
```graphql
208350
type Customer {
@@ -228,9 +370,23 @@ query {
228370

229371
## Country Code Scalar
230372

231-
| Scalar Name | Scalar Specification | Description |
232-
| ------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
233-
| `CountryCode` | <pre lang="graphql">scalar CountryCode</pre> | The CountryCode scalar type as defined by [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). |
373+
<table>
374+
<tr>
375+
<td>Scalar Name</td>
376+
<td>Scalar Specification</td>
377+
<td>Description</td>
378+
</tr>
379+
<tr>
380+
<td><code>CountryCode</code></td>
381+
<td><pre lang="graphql">
382+
scalar CountryCode
383+
@specifiedBy(url:
384+
"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2"
385+
)
386+
</pre></td>
387+
<td>The CountryCode scalar type as defined by <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>.</td>
388+
</tr>
389+
</table>
234390

235391
An example declaration in SDL might be:
236392

@@ -256,9 +412,23 @@ query {
256412

257413
## Currency Scalar
258414

259-
| Scalar Name | Scalar Specification | Description |
260-
| ----------- | ----------------------------------------- | -------------------------------------------------------------------------------------- |
261-
| `Currency` | <pre lang="graphql">scalar Currency</pre> | A field whose value is an [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) currency. |
415+
<table>
416+
<tr>
417+
<td>Scalar Name</td>
418+
<td>Scalar Specification</td>
419+
<td>Description</td>
420+
</tr>
421+
<tr>
422+
<td><code>Currency</code></td>
423+
<td><pre lang="graphql">
424+
scalar Currency
425+
@specifiedBy(url:
426+
"https://en.wikipedia.org/wiki/ISO_4217"
427+
)
428+
</pre></td>
429+
<td>A field whose value is an <a href="https://en.wikipedia.org/wiki/ISO_4217">ISO-4217</a> currency.</td>
430+
</tr>
431+
</table>
262432

263433
An example declaration in SDL might be:
264434

@@ -293,28 +463,36 @@ query {
293463
<td>Description</td>
294464
</tr>
295465
<tr>
296-
<td><pre>Url</pre></td>
466+
<td><code>Url</code></td>
297467
<td><pre lang="graphql">
298468
scalar URL
299469
@specifiedBy(url:
300470
"https://www.w3.org/Addressing/URL/url-spec.txt"
301471
)
302-
</pre>
303-
</td>
472+
</pre></td>
304473
<td>An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.</td>
305474
</tr>
306475
</table>
307476

308-
| Scalar Name | Scalar Specification | Description |
309-
| ----------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
310-
| `Url` | <pre lang="graphql">scalar URL @specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")</pre> | An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. |
311-
312477
## Object / JSON Scalars
313478

314-
| Scalar Name | Scalar Specification | Description |
315-
| ----------- | --------------------------------------- | ------------------------------------------------------------------------------- |
316-
| `Object` | <pre lang="graphql">scalar Object</pre> | An object scalar that accepts any object as a scalar value. |
317-
| `JSON` | <pre lang="graphql">scalar JSON</pre> | A synonym for the `Object` scalar, it will accept any object as a scalar value. |
479+
<table>
480+
<tr>
481+
<td>Scalar Name</td>
482+
<td>Scalar Specification</td>
483+
<td>Description</td>
484+
</tr>
485+
<tr>
486+
<td><code>Object</code></td>
487+
<td><pre lang="graphql">scalar Object</pre></td>
488+
<td>An object scalar that accepts any object as a scalar value.</td>
489+
</tr>
490+
<tr>
491+
<td><code>JSON</code></td>
492+
<td><pre lang="graphql">scalar JSON</pre></td>
493+
<td>A synonym for the `Object` scalar, it will accept any object as a scalar value.</td>
494+
</tr>
495+
</table>
318496

319497
One of the design goals of GraphQL, is that the type system describes the shape of the data returned.
320498

@@ -360,9 +538,18 @@ adds more semantic readers to your schema consumers.
360538

361539
## Regex Scalars
362540

363-
| Scalar Name | Scalar Specification | Description |
364-
| ------------- | -------------------- | -------------------------------------------------------------------------------- |
365-
| `RegexScalar` | - | Allows you to build a new scalar via a builder pattern using regular expressions |
541+
<table>
542+
<tr>
543+
<td>Scalar Name</td>
544+
<td>Scalar Specification</td>
545+
<td>Description</td>
546+
</tr>
547+
<tr>
548+
<td><code>RegexScalar</code></td>
549+
<td><pre lang="graphql">-</pre></td>
550+
<td>Allows you to build a new scalar via a builder pattern using regular expressions.</td>
551+
</tr>
552+
</table>
366553

367554
The RegexScalar has a builder where you provide one or more regex patterns that control the acceptable values
368555
for a new scalar.

0 commit comments

Comments
 (0)