Add missing Oxford commas, add descriptions for enums, render interface fields

This commit is contained in:
Brian Beck 2016-11-29 18:18:50 -08:00
parent b0319ffb39
commit 2dfd2aa88d
8 changed files with 59 additions and 21 deletions

View file

@ -226,7 +226,7 @@ type ArtistConnection {
# [Artist credits](https://musicbrainz.org/doc/Artist_Credits) # [Artist credits](https://musicbrainz.org/doc/Artist_Credits)
# indicate who is the main credited artist (or artists) for releases, release # indicate who is the main credited artist (or artists) for releases, release
# groups, tracks and recordings, and how they are credited. They consist of # groups, tracks, and recordings, and how they are credited. They consist of
# artists, with (optionally) their names as credited in the specific release, # artists, with (optionally) their names as credited in the specific release,
# track, etc., and join phrases between them. # track, etc., and join phrases between them.
type ArtistCredit { type ArtistCredit {
@ -796,7 +796,7 @@ type PageInfo {
endCursor: String endCursor: String
} }
# A [place](https://musicbrainz.org/doc/Place) is a venue, studio # A [place](https://musicbrainz.org/doc/Place) is a venue, studio,
# or other place where music is performed, recorded, engineered, etc. # or other place where music is performed, recorded, engineered, etc.
type Place implements Node, Entity { type Place implements Node, Entity {
# The ID of an object # The ID of an object
@ -1487,6 +1487,8 @@ type ReleaseGroupEdge {
score: Int score: Int
} }
# A type used to describe release groups, e.g. album, single, EP,
# etc.
enum ReleaseGroupType { enum ReleaseGroupType {
# An album, perhaps better defined as a “Long Play” (LP) # An album, perhaps better defined as a “Long Play” (LP)
# release, generally consists of previously unreleased material (unless this type # release, generally consists of previously unreleased material (unless this type
@ -1568,6 +1570,8 @@ enum ReleaseGroupType {
NAT NAT
} }
# A type used to describe the status of releases, e.g. official,
# bootleg, etc.
enum ReleaseStatus { enum ReleaseStatus {
# Any release officially sanctioned by the artist and/or their # Any release officially sanctioned by the artist and/or their
# record company. (Most releases will fit into this category.) # record company. (Most releases will fit into this category.)
@ -1901,4 +1905,4 @@ type WorkEdge {
# these results were found through a search. # these results were found through a search.
score: Int score: Int
} }
``` ```

View file

@ -604,7 +604,7 @@ ignoring pagination.</td>
[Artist credits](https://musicbrainz.org/doc/Artist_Credits) [Artist credits](https://musicbrainz.org/doc/Artist_Credits)
indicate who is the main credited artist (or artists) for releases, release indicate who is the main credited artist (or artists) for releases, release
groups, tracks and recordings, and how they are credited. They consist of groups, tracks, and recordings, and how they are credited. They consist of
artists, with (optionally) their names as credited in the specific release, artists, with (optionally) their names as credited in the specific release,
track, etc., and join phrases between them. track, etc., and join phrases between them.
@ -1664,7 +1664,7 @@ Information about pagination in a connection.
### Place ### Place
A [place](https://musicbrainz.org/doc/Place) is a venue, studio A [place](https://musicbrainz.org/doc/Place) is a venue, studio,
or other place where music is performed, recorded, engineered, etc. or other place where music is performed, recorded, engineered, etc.
<table><thead> <table><thead>
@ -3769,6 +3769,9 @@ these results were found through a search.</td>
### ReleaseGroupType ### ReleaseGroupType
A type used to describe release groups, e.g. album, single, EP,
etc.
<table><thead> <table><thead>
<th align="left">Value</th> <th align="left">Value</th>
<th align="left">Description</th> <th align="left">Description</th>
@ -3872,6 +3875,9 @@ reference use rather than for general public release.</td>
### ReleaseStatus ### ReleaseStatus
A type used to describe the status of releases, e.g. official,
bootleg, etc.
<table><thead> <table><thead>
<th align="left">Value</th> <th align="left">Value</th>
<th align="left">Description</th> <th align="left">Description</th>
@ -3947,11 +3953,35 @@ A web address.
## Interfaces ## Interfaces
### Entity ### Entity
An entity in the MusicBrainz schema. An entity in the MusicBrainz schema.
<table><thead>
<th align="left">Field&nbsp;/&nbsp;Argument</th>
<th align="left">Type</th>
<th align="left">Description</th>
</thead><tbody>
<tr>
<td valign="top"><strong>mbid</strong></td>
<td valign="top"><a href="#mbid">MBID</a>!</td>
<td>The MBID of the entity.</td>
</tr>
</tbody></table>
### Node ### Node
An object with an ID An object with an ID
<table><thead>
<th align="left">Field&nbsp;/&nbsp;Argument</th>
<th align="left">Type</th>
<th align="left">Description</th>
</thead><tbody>
<tr>
<td valign="top"><strong>id</strong></td>
<td valign="top"><a href="#id">ID</a>!</td>
<td>The id of the object.</td>
</tr>
</tbody></table>

View file

@ -19,7 +19,7 @@
"build": "npm run build:lib && npm run update-schema && npm run build:docs", "build": "npm run build:lib && npm run update-schema && npm run build:docs",
"build:docs": "npm run build:docs:readme && npm run build:docs:schema && npm run build:docs:types", "build:docs": "npm run build:docs:readme && npm run build:docs:schema && npm run build:docs:types",
"build:docs:readme": "doctoc --title \"## Contents\" README.md", "build:docs:readme": "doctoc --title \"## Contents\" README.md",
"build:docs:schema": "printf '# GraphQL Schema\\n\\n%s' \"$(npm run -s print-schema:md)\" > docs/schema.md", "build:docs:schema": "printf '# GraphQL Schema\\n\\n%s\n' \"$(npm run -s print-schema:md)\" > docs/schema.md",
"build:docs:types": "babel-node scripts/render-types.js > docs/types.md", "build:docs:types": "babel-node scripts/render-types.js > docs/types.md",
"build:lib": "babel --out-dir lib src", "build:lib": "babel --out-dir lib src",
"clean": "npm run clean:lib", "clean": "npm run clean:lib",

View file

@ -2130,7 +2130,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "ArtistCredit", "name": "ArtistCredit",
"description": "[Artist credits](https://musicbrainz.org/doc/Artist_Credits)\nindicate who is the main credited artist (or artists) for releases, release\ngroups, tracks and recordings, and how they are credited. They consist of\nartists, with (optionally) their names as credited in the specific release,\ntrack, etc., and join phrases between them.", "description": "[Artist credits](https://musicbrainz.org/doc/Artist_Credits)\nindicate who is the main credited artist (or artists) for releases, release\ngroups, tracks, and recordings, and how they are credited. They consist of\nartists, with (optionally) their names as credited in the specific release,\ntrack, etc., and join phrases between them.",
"fields": [ "fields": [
{ {
"name": "artist", "name": "artist",
@ -2177,7 +2177,7 @@
{ {
"kind": "ENUM", "kind": "ENUM",
"name": "ReleaseGroupType", "name": "ReleaseGroupType",
"description": null, "description": "A type used to describe release groups, e.g. album, single, EP,\netc.",
"fields": null, "fields": null,
"inputFields": null, "inputFields": null,
"interfaces": null, "interfaces": null,
@ -2284,7 +2284,7 @@
{ {
"kind": "ENUM", "kind": "ENUM",
"name": "ReleaseStatus", "name": "ReleaseStatus",
"description": null, "description": "A type used to describe the status of releases, e.g. official,\nbootleg, etc.",
"fields": null, "fields": null,
"inputFields": null, "inputFields": null,
"interfaces": null, "interfaces": null,
@ -5892,7 +5892,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Place", "name": "Place",
"description": "A [place](https://musicbrainz.org/doc/Place) is a venue, studio\nor other place where music is performed, recorded, engineered, etc.", "description": "A [place](https://musicbrainz.org/doc/Place) is a venue, studio,\nor other place where music is performed, recorded, engineered, etc.",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",

View file

@ -1,6 +1,12 @@
import marked from 'marked' import marked from 'marked'
const schema = require('../schema.json').data.__schema const schema = require('../schema.json').data.__schema
// Ideally, we could just spit out the existing description Markdown everywhere
// and leave it to be rendered by whatever processes the output. But some
// Markdown renderers, including GitHub's, don't process Markdown if it's within
// an HTML tag. So in some places (like descriptions of the types themselves) we
// just output the raw description. In other places, like table cells, we need
// to output pre-rendered Markdown, otherwise GitHub won't interpret it.
marked.setOptions({ marked.setOptions({
breaks: false breaks: false
}) })
@ -110,7 +116,6 @@ console.log('\n## Objects')
objects.forEach(type => renderObject(type)) objects.forEach(type => renderObject(type))
console.log('\n## Enums') console.log('\n## Enums')
enums.forEach(type => { enums.forEach(type => {
console.log(`\n### ${type.name}\n`) console.log(`\n### ${type.name}\n`)
if (type.description) { if (type.description) {
@ -130,7 +135,6 @@ enums.forEach(type => {
}) })
console.log('\n## Scalars\n') console.log('\n## Scalars\n')
scalars.forEach(type => { scalars.forEach(type => {
console.log(`### ${type.name}\n`) console.log(`### ${type.name}\n`)
if (type.description) { if (type.description) {
@ -139,10 +143,4 @@ scalars.forEach(type => {
}) })
console.log('\n## Interfaces\n') console.log('\n## Interfaces\n')
interfaces.forEach(type => renderObject(type))
interfaces.forEach(type => {
console.log(`### ${type.name}\n`)
if (type.description) {
console.log(`${type.description}\n`)
}
})

View file

@ -5,7 +5,7 @@ export default new GraphQLObjectType({
name: 'ArtistCredit', name: 'ArtistCredit',
description: `[Artist credits](https://musicbrainz.org/doc/Artist_Credits) description: `[Artist credits](https://musicbrainz.org/doc/Artist_Credits)
indicate who is the main credited artist (or artists) for releases, release indicate who is the main credited artist (or artists) for releases, release
groups, tracks and recordings, and how they are credited. They consist of groups, tracks, and recordings, and how they are credited. They consist of
artists, with (optionally) their names as credited in the specific release, artists, with (optionally) their names as credited in the specific release,
track, etc., and join phrases between them.`, track, etc., and join phrases between them.`,
fields: () => ({ fields: () => ({

View file

@ -2,6 +2,8 @@ import { GraphQLEnumType } from 'graphql/type'
export const ArtistType = new GraphQLEnumType({ export const ArtistType = new GraphQLEnumType({
name: 'ArtistType', name: 'ArtistType',
description: `A type used to describe artists, e.g. person, group, character,
etc.`,
values: { values: {
PERSON: { PERSON: {
name: 'Person', name: 'Person',
@ -39,6 +41,8 @@ distinctive name.`,
export const ReleaseStatus = new GraphQLEnumType({ export const ReleaseStatus = new GraphQLEnumType({
name: 'ReleaseStatus', name: 'ReleaseStatus',
description: `A type used to describe the status of releases, e.g. official,
bootleg, etc.`,
values: { values: {
OFFICIAL: { OFFICIAL: {
name: 'Official', name: 'Official',
@ -70,6 +74,8 @@ translation/transliteration purposes.`,
export const ReleaseGroupType = new GraphQLEnumType({ export const ReleaseGroupType = new GraphQLEnumType({
name: 'ReleaseGroupType', name: 'ReleaseGroupType',
description: `A type used to describe release groups, e.g. album, single, EP,
etc.`,
values: { values: {
ALBUM: { ALBUM: {
name: 'Album', name: 'Album',

View file

@ -34,7 +34,7 @@ export const Coordinates = new GraphQLObjectType({
const Place = new GraphQLObjectType({ const Place = new GraphQLObjectType({
name: 'Place', name: 'Place',
description: `A [place](https://musicbrainz.org/doc/Place) is a venue, studio description: `A [place](https://musicbrainz.org/doc/Place) is a venue, studio,
or other place where music is performed, recorded, engineered, etc.`, or other place where music is performed, recorded, engineered, etc.`,
interfaces: () => [Node, Entity], interfaces: () => [Node, Entity],
fields: () => ({ fields: () => ({