Skip to content

Commit

Permalink
Merge branch 'suggestion/author-fields'
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Oct 20, 2023
2 parents aa6c0dc + cc30f32 commit 00e6045
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ Examples of how to validate can be found here: _---TODO---_
"$schema": "https://superflytv.github.io/GraphicsDataDefinition/gdd-meta-schema/v1/schema.json", // [optional] Reference to the JSON-schema
"title": "", // [optional] string, a short name of the GFX-template. Used for informational purposes only.
"description": "", // [optional] string, a description GFX-template. Used for informational purposes only.
"authorName": "", // [optional] string, name of the author.
"authorEmail": "", // [optional] string, email to the author.
"type": "object", // MUST be "object"
"properties": {
// MUST be an object
Expand Down
9 changes: 9 additions & 0 deletions gdd-meta-schema/v1/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
"type": "string",
"description": "A description GFX-template. Used for informational purposes only."
},
"authorName": {
"type": "string",
"description": "Name of the author"
},
"authorEmail": {
"type": "string",
"description": "Email to the author",
"format": "email"
},
"properties": {
"type": "object",
"patternProperties": {
Expand Down
16 changes: 16 additions & 0 deletions lib/unit-tests/__tests__/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ describe('Schema - Basic types', () => {
})
).toMatch(/not.*object/)

expect(
validateSchema({
type: 'object',
properties: {},
authorName: 123, // bad type
})
).toMatch(/not.*string/)
expect(
validateSchema({
type: 'object',
properties: {},
authorEmail: 'not-an-email', // bad format
})
).toMatch(/does not conform.*email.*format/)
expect(
validateSchema({
type: 'object',
Expand All @@ -97,6 +111,8 @@ describe('Schema - Basic types', () => {
title: 'A title',
description: 'a description',
$schema: 'https://superflytv.github.io/GraphicsDataDefinition/gdd-meta-schema/v1/schema.json',
authorName: 'author',
authorEmail: '[email protected]',
gddPlayoutOptions: {},
})
).toBe(null)
Expand Down

0 comments on commit 00e6045

Please sign in to comment.