Skip to content

Commit ff9e86a

Browse files
authored
Merge pull request #1656 from fturmel/PR/improve-content-testing-videoId
Improve content test for `videoId` field
2 parents 2aa3496 + a50f243 commit ff9e86a

File tree

34 files changed

+11
-37
lines changed

34 files changed

+11
-37
lines changed

content-testing/schemas.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ const baseVideosSchema = strictObject({
2121
title: string().required(),
2222
description: string().required(),
2323

24-
videoId: youtubeIdValidator.when(['parts'], (parts, schema) => {
24+
videoId: youtubeIdValidator.when('parts', ([parts], schema) => {
2525
// videoId required if the `parts` array is missing or empty
26-
return parts && parts.length > 0 ? schema : schema.required();
26+
return parts && parts.length > 0
27+
? schema.test(
28+
'videoId and parts conflict',
29+
'Top-level "videoId" should not be defined if "parts" exist',
30+
(value) => value === undefined
31+
)
32+
: schema.required();
2733
}),
2834

2935
nebulaSlug: nonUrlStringValidator,

content/videos/challenges/10-dfs-maze-generator/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Maze Generator",
33
"description": "Choo choo! In this multi-part coding challenge, I create a maze generator using a depth-first search algorithm with recursive backtracking. The idea is to walk through a grid of cells, removing walls as we go to build a maze.",
44
"videoNumber": "10",
5-
"videoId": "",
65
"date": "2016-05-02",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["maze", "recursion", "backtracking", "depth-first search"],

content/videos/challenges/100-neuroevolution-flappy-bird/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Neuroevolution Flappy Bird",
33
"description": "In this challenge, I use my JavaScript neural network library and a genetic algorithm to train an agent to play Flappy Bird.",
44
"videoNumber": "100",
5-
"videoId": "c6y21FkaUqw",
65
"date": "2018-04-16",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["neural network", "reinforcement learning", "genetic algorithms", "evolution", "Flappy Bird game"],

content/videos/challenges/110-recamans-sequence/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Recamán's Sequence",
33
"description": "In this coding challenge, I visualize the Recamán’s number sequence using the p5.js library and go on to generate a series of musical tones using p5.js sound.",
44
"videoNumber": "110",
5-
"videoId": "",
65
"date": "2018-07-24",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["number sequence", "Recamán's sequence", "music", "audio-visual", "visualization"],

content/videos/challenges/121-logo-interpreter/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Logo Interpreter",
33
"description": "In this coding challenge, I discuss turtle graphics and make a Logo Interpreter in JavaScript.",
44
"videoNumber": "121",
5-
"videoId": "",
65
"date": "2018-10-31",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["Logo", "Logo interpreter", "turtle graphics"],

content/videos/challenges/122-quick-draw/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Quick, Draw!",
33
"description": "In this multi-part coding challenge, I take a closer look at the Quick, Draw! dataset and create a simple node API to \"replay\" drawings of rainbows and cats using p5.js.",
44
"videoNumber": "122",
5-
"videoId": "",
65
"date": "2018-11-19",
76
"languages": ["p5.js", "Node.js", "JavaScript"],
87
"topics": ["Quick, Draw! game", "machine learning (ML)", "doodle classifiers", "sketch-RNN"],

content/videos/challenges/123-chaos-game/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Chaos Game",
33
"description": "In this multi-part coding challenge, I visualize the \"Chaos Game\".",
44
"videoNumber": "123",
5-
"videoId": "",
65
"date": "2018-11-29",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["chaos game", "fractal", "seed points", "probability"],

content/videos/challenges/130-drawing-with-fourier-transform-and-epicycles/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Drawing with Fourier Transform and Epicycles",
33
"description": "In this coding challenge, I implement the Discrete Fourier Transform algorithm in JavaScript and render a drawing using epicycles derived from the transform.",
44
"videoNumber": "130",
5-
"videoId": "MY4luNgGfms",
65
"date": "2019-01-24",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["Fourier transform square wave", "discrete Fourier transform", "epicycles drawing"],

content/videos/challenges/134-heart-curve/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Heart Curve",
33
"description": "In this multi-part challenge, I use a parametric equation (from Wolfram Mathworld) to draw a heart curve in Processing (Java).",
44
"videoNumber": "134",
5-
"videoId": "",
65
"date": "2019-02-18",
76
"languages": ["Processing"],
87
"topics": ["heart curve", "parametric equation", "polar coordinates", "GIF loop"],

content/videos/challenges/136-polar-noise-loops/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Polar Noise Loops",
33
"description": "In this multi-part coding challenge I show how to use a noise field and polar coordinates to create a perfect GIF loop.",
44
"videoNumber": "136",
5-
"videoId": "",
65
"date": "2019-02-25",
76
"languages": ["p5.js", "Processing"],
87
"topics": ["GIF loop", "Perlin noise", "polar coordinates"],

content/videos/challenges/142-rubiks-cube/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Rubik's Cube",
33
"description": "Can I build an interactive 3D Rubik's cube in Processing? Yes! Someday I hope to return to this project and add an AI solver!",
44
"videoNumber": "142",
5-
"videoId": "",
65
"date": "2019-04-01",
76
"languages": ["Processing"],
87
"topics": ["Rubik's cube", "rotation matrix", "peasyCam", "simulation"],

content/videos/challenges/32-agario/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Agar.io",
33
"description": "In this multi-part coding challenge, I create a clone of the multiplayer online game Agar.io with JavaScript, node.js and websockets.",
44
"videoNumber": "32",
5-
"videoId": "",
65
"date": "2016-08-16",
76
"languages": ["JavaScript", "Node.js"],
87
"topics": ["agar.io", "WebSocket"],

content/videos/challenges/35-traveling-salesperson/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Traveling Salesperson",
33
"description": "In Part 1 of this multi-part coding challenge, I introduce the classic computer science problem of the Traveling Salesperson (TSP) and discuss the pitfalls with a brute force solution. In Part 2, I discuss Lexicographic Ordering and demonstrate one algorithm to iterate over all the permutations of an array. In Part 3, I apply this algorithm to a brute-force solution of the TSP problem. Every single route permutation is checked one by one. In Part 4, I attempt to create a solution to the TSP problem with a genetic algorithm, and then I add a “crossover” algorithm in Part 5.",
44
"videoNumber": "35",
5-
"videoId": "BAejnwN4Ccw",
65
"date": "2016-08-24",
76
"languages": ["p5.js"],
87
"topics": [

content/videos/challenges/40-word-counter/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Word Counter",
33
"description": "In this challenge, we build a word counting (concordance) application, and visualize the frequency of each word using variable font size! We also implement the TF-IDF algorithm",
44
"videoNumber": "40",
5-
"videoId": "",
65
"date": "2016-10-10",
76
"languages": ["p5.js", "Processing", "JavaScript", "Java"],
87
"topics": ["word counting", "visualization", "tf-idf"],

content/videos/challenges/42-markov-chain-name-generator/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Markov Chain Name Generator",
33
"description": "In this multi-part coding challenge I attempt to use a Markov Chain to generate a new name for my YouTube channel.",
44
"videoNumber": "42",
5-
"videoId": "",
65
"date": "2016-10-24",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["Markov chain", "n-gram", "text generator"],

content/videos/challenges/44-afinn-111-sentiment-analysis/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "AFINN-111 Sentiment Analysis",
33
"description": "In this multi-part coding challenge I implement sentiment analysis using the AFINN-111 word list.",
44
"videoNumber": "44",
5-
"videoId": "",
65
"date": "2016-12-01",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["sentiment analysis", "AFINN-111"],

content/videos/challenges/46-asteroids/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Asteroids",
33
"description": "In this two part coding challenge, I use the p5.js library to create my own version of the classic Atari video game Asteroids!",
44
"videoNumber": "46",
5-
"videoId": "",
65
"date": "2016-12-15",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["Atari Asteroids game", "polar to Cartesian coordinates"],

content/videos/challenges/50-animated-circle-packing/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Circle Packing",
33
"description": "In this multi-part coding challenge, I demonstrate how to use a circle packing algorithm.",
44
"videoNumber": "50",
5-
"videoId": "",
65
"date": "2017-01-09",
76
"languages": ["Processing"],
87
"topics": ["circle packing", "pixels"],

content/videos/challenges/51-a-pathfinding-algorithm/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "A* Pathfinding Algorithm",
33
"description": "In this multi-part coding challenge, I attempt an implementation of the A* Pathfinding Algorithm to find the optimal path between two points in a 2D grid.",
44
"videoNumber": "51",
5-
"videoId": "",
65
"date": "2017-01-16",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["A* algorithm", "pathfinding", "heuristic"],

content/videos/challenges/54-islamic-star-patterns/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Islamic Star Patterns",
33
"description": "In this bonus super-sized coding challenge, I work through visualizing Islamic Star Patterns in p5.js.",
44
"videoNumber": "54",
5-
"videoId": "",
65
"date": "2017-02-01",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["Islamic star patterns", "Hankin's method", "tile pattern", "law of sines"],

content/videos/challenges/62-plinko-with-matterjs/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Plinko with Matter.js",
33
"description": "I love all things random and chance so why not make a Plink simulation with the matter.js physics engine and p5.js!",
44
"videoNumber": "62",
5-
"videoId": "KakpnfDv_f0",
65
"date": "2017-03-10",
76
"languages": ["JavaScript", "p5.js", "Matter.js"],
87
"topics": ["collision detection", "matter.js", "physics engine", "Plinko game"],

content/videos/challenges/63-texturing-cloth-simulation/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Texturing Cloth Simulation",
33
"description": "In this two part challenge, I cover beginShape(), endShape(), and texture(), TRIANGLE_STRIP, QUAD_STRIP, and more. I combine these geometry functions with the Toxiclibs physics library to simulate a waving flag (with a unikitty image texture!)",
44
"videoNumber": "63",
5-
"videoId": "",
65
"date": "2017-03-14",
76
"languages": ["Processing", "Java"],
87
"topics": ["physics engine", "texture 3D", "Toxiclibs", "cloth", "simulation"],

content/videos/challenges/64-kinematics/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Kinematics",
33
"description": "In this multi-part coding challenge, I demonstrate how to implement kinematics in Processing (Java).",
44
"videoNumber": "64",
5-
"videoId": "xXjRlEr7AGk",
65
"date": "2017-03-16",
76
"languages": ["Processing"],
87
"topics": ["forward kinematics", "inverse kinematics", "tentacle animation", "linked lists", "array"],

content/videos/challenges/65-binary-tree/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Binary Tree",
33
"description": "This multi-part coding challenge is part of the first week of my course: \"Intelligence and Learning.\" Here I attempt to implement a classic data structure: The Binary Search Tree.",
44
"videoNumber": "65",
5-
"videoId": "ZNH0MuQ51m4",
65
"date": "2017-03-21",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["tree", "binary search", "data structure", "intelligence and learning"],

content/videos/challenges/68-breadth-first-search/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Breadth-First Search",
33
"description": "In this two part challenge, I implement the Breadth-First Search algorithm in JavaScript. My demo application is \"6 Degrees of Kevin Bacon\" (finding the closest relationship between Kevin Bacon and another actor).",
44
"videoNumber": "68",
5-
"videoId": "piBq7VD0ZSo",
65
"date": "2017-03-30",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["breadth-first search algorithm", "Six Degrees of Kevin Bacon"],

content/videos/challenges/69-evolutionary-steering-behaviors/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Evolutionary Steering Behaviors",
33
"description": "In this multi-part coding challenge, I create a system where autonomous steering agents evolve the behavior of eating food and avoiding poison.",
44
"videoNumber": "69",
5-
"videoId": "flxOkx0yLrY",
65
"date": "2017-04-18",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["genetic algorithms", "steering behaviors", "seek function", "autonomous agent", "evolution"],

content/videos/challenges/70-nearest-neighbors-recommendation-engine/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Nearest Neighbors Recommendation Engine",
33
"description": "In this multi-part coding challenge, I create a movie recommendation engine using the \"nearest neighbor\" algorithm.",
44
"videoNumber": "70",
5-
"videoId": "",
65
"date": "2017-05-09",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["nearest neighbors", "similarity score", "Euclidean distance", "associative arrays"],

content/videos/challenges/72-frogger/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Frogger",
33
"description": "In this multi-part challenge, I create a simplified version of the classic Atari video game Frogger in Processing (Java).",
44
"videoNumber": "72",
5-
"videoId": "giXV6xErw0Y",
65
"date": "2017-06-14",
76
"languages": ["Processing"],
87
"topics": ["game mechanics", "Atari Frogger game", "inheritance"],

content/videos/challenges/81-circle-morphing/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Circle Morphing",
33
"description": "In this multi-part challenge, I implement two possible solutions to Golan Levin's Circle Morphing challenge.",
44
"videoNumber": "81",
5-
"videoId": "u2D4sxh3MTs",
65
"date": "2017-11-01",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["Golan Levin", "interpolation", "circle morphing", "polar coordinates"],

content/videos/challenges/91-snakes-and-ladders/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Snakes & Ladders",
33
"description": "In this multi-part coding challenge, I attempt to create a simulation of the classic board game Snakes & Ladders (also known as Chutes and Ladders).",
44
"videoNumber": "91",
5-
"videoId": "",
65
"date": "2018-01-29",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["Snakes & ladders game", "games"],

content/videos/challenges/94-2048/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "2048 Sliding Puzzle Game",
33
"description": "In this multi-part coding challenge, I code the sliding puzzle game 2048 in JavaScript using canvas and p5.js.",
44
"videoNumber": "94",
5-
"videoId": "JSn-DJU8qf0",
65
"date": "2018-02-26",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["2048 game", "sliding puzzle game"],

content/videos/challenges/97-book-of-pi/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "The Book of Pi",
33
"description": "In yet another “Pi Day” coding challenge, I attempt to generate a pdf “Book of Pi” with the first 10 million digits of Pi mapped to color. Processing (Java) is used for this project.",
44
"videoNumber": "97",
5-
"videoId": "",
65
"date": "2018-03-20",
76
"languages": ["Processing", "Java"],
87
"topics": ["Pi", "Pi day", "visualization"],

content/videos/challenges/98-quadtree/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Quadtree",
33
"description": "In this multi-part coding challenge, I implement a Quadtree data structure in JavaScript and visualize it with p5.js.",
44
"videoNumber": "98",
5-
"videoId": "OJxEcs0w_kE",
65
"date": "2018-03-26",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["quadtree data structure", "quadtree collision detection"],

gatsby/createSchemaCustomization.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const schema = /* GraphQL */ `
66
id: ID!
77
title: String!
88
slug: String!
9-
videoId: String!
9+
videoId: String
1010
description: String!
1111
date: String
1212
videoNumber: String
@@ -32,7 +32,7 @@ const schema = /* GraphQL */ `
3232
id: ID!
3333
title: String!
3434
slug: String!
35-
videoId: String!
35+
videoId: String
3636
description: String!
3737
date: String
3838
videoNumber: String
@@ -58,7 +58,7 @@ const schema = /* GraphQL */ `
5858
id: ID!
5959
title: String!
6060
slug: String!
61-
videoId: String!
61+
videoId: String
6262
description: String!
6363
date: String
6464
videoNumber: String

0 commit comments

Comments
 (0)