diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/album.js | 4 | ||||
-rw-r--r-- | src/data/things/artist.js | 6 | ||||
-rw-r--r-- | src/data/things/flash.js | 8 | ||||
-rw-r--r-- | src/data/things/group.js | 4 | ||||
-rw-r--r-- | src/data/things/homepage-layout.js | 4 | ||||
-rw-r--r-- | src/data/things/static-page.js | 4 | ||||
-rw-r--r-- | src/data/things/track.js | 4 | ||||
-rw-r--r-- | src/data/yaml.js | 17 |
8 files changed, 28 insertions, 23 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index 3a05ac83..9e6d28d9 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -279,9 +279,9 @@ export class Album extends Thing { 'Groups': {property: 'groups'}, 'Art Tags': {property: 'artTags'}, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, }; } diff --git a/src/data/things/artist.js b/src/data/things/artist.js index 502510a8..ab08f522 100644 --- a/src/data/things/artist.js +++ b/src/data/things/artist.js @@ -251,8 +251,10 @@ export class Artist extends Thing { 'Avatar File Extension': {property: 'avatarFileExtension'}, 'Aliases': {property: 'aliasNames'}, - }, - ignoredFields: ['Dead URLs', 'Review Points'], + 'Dead URLs': {ignore: true}, + + 'Review Points': {ignore: true}, + }, }; } diff --git a/src/data/things/flash.js b/src/data/things/flash.js index 7e859bfa..945d80dd 100644 --- a/src/data/things/flash.js +++ b/src/data/things/flash.js @@ -147,9 +147,9 @@ export class Flash extends Thing { property: 'contributorContribs', transform: parseContributors, }, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, }; } @@ -200,8 +200,8 @@ export class FlashAct extends Thing { 'Jump': {property: 'jump'}, 'Jump Color': {property: 'jumpColor'}, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, }; } diff --git a/src/data/things/group.js b/src/data/things/group.js index fe04dfaa..adcd6ad1 100644 --- a/src/data/things/group.js +++ b/src/data/things/group.js @@ -93,9 +93,9 @@ export class Group extends Thing { 'URLs': {property: 'urls'}, 'Featured Albums': {property: 'featuredAlbums'}, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, }; } diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js index bd0970fe..38fd5a7a 100644 --- a/src/data/things/homepage-layout.js +++ b/src/data/things/homepage-layout.js @@ -42,11 +42,11 @@ export class HomepageLayout extends Thing { static [Thing.yamlDocumentSpec] = { fields: { + 'Homepage': {ignore: true}, + 'Sidebar Content': {property: 'sidebarContent'}, 'Navbar Links': {property: 'navbarLinks'}, }, - - ignoredFields: ['Homepage'], }; } diff --git a/src/data/things/static-page.js b/src/data/things/static-page.js index 7f8b7c91..2da7312b 100644 --- a/src/data/things/static-page.js +++ b/src/data/things/static-page.js @@ -38,8 +38,8 @@ export class StaticPage extends Thing { 'Style': {property: 'stylesheet'}, 'Script': {property: 'script'}, 'Content': {property: 'content'}, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, }; } diff --git a/src/data/things/track.js b/src/data/things/track.js index 9f44bd8d..dd102683 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -412,9 +412,9 @@ export class Track extends Thing { }, 'Art Tags': {property: 'artTags'}, - }, - ignoredFields: ['Review Points'], + 'Review Points': {ignore: true}, + }, invalidFieldCombinations: [ {message: `Re-releases inherit references from the original`, fields: [ diff --git a/src/data/yaml.js b/src/data/yaml.js index 19f56292..fe8bfdc0 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -80,14 +80,12 @@ function makeProcessDocument(thingConstructor, { // YAML into some other format before providing setting it on the Thing // instance. // - fields: fieldSpecs = {}, - - // Completely ignored fields. These won't throw an unknown field error if - // they're present in a document, but they won't be used for Thing property - // generation, either. Useful for stuff that's present in data files but not - // yet implemented as part of a Thing's data model! + // If a field entry has `ignore: true`, it will be completely skipped by the + // YAML parser - it won't be validated, read, or loaded into data objects. + // This is mainly useful for fields that are purely annotational or are + // currently placeholders. // - ignoredFields = [], + fields: fieldSpecs = {}, // List of fields which are invalid when coexisting in a document. // Data objects are generally allowing with regards to what properties go @@ -120,6 +118,11 @@ function makeProcessDocument(thingConstructor, { const knownFields = Object.keys(fieldSpecs); + const ignoredFields = + Object.entries(fieldSpecs) + .filter(([, {ignore}]) => ignore) + .map(([field]) => field); + const propertyToField = withEntries(fieldSpecs, entries => entries .map(([field, {property}]) => [property, field])); |