schema

package
v0.0.0-...-0872f49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const SCHEMA = "http://json-schema.org/draft-04/schema#"

Variables

View Source
var CompositionLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "MusicComposition",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"@context": {
			"type": "string",
			"pattern": "^%s$"
		},
		"@type": {
			"type": "string",
			"pattern": "^MusicComposition$"
		},
		"composer": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},	
			"minItems": 1,
			"uniqueItems": true
		},
		"inLanguage": {
			"type": "string",
			"pattern": "%s"
		},
		"iswcCode": {
			"type": "string",
			"pattern": "%s"
		},
		"name": {
			"type": "string"
		},
		"publisher": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},	
			"minItems": 1,
			"uniqueItems": true
		},
		"url": {
			"type": "string"
		}
	},
	"required": ["@context", "@type", "composer", "name"]
}`, SCHEMA, link, spec.CONTEXT, regex.LANGUAGE, regex.ISWC))
View Source
var LicenseLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "License",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"@context": {
			"type": "string",
			"pattern": "^%s$"
		},
		"@type": {
			"type": "string",
			"pattern": "^License$"
		},
		"licenseFor": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},
			"minItems": 1,
			"uniqueItems": true
		},
		"licenseHolder": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},
			"minItems": 1,
			"uniqueItems": true
		},
		"licenser": {
			"allOf": [
				{
					"$ref": "#/definitions/link"
				},
				{
					"properties": {
						"hasRight": {
							"type": "array",
							"items": {
								"$ref": "#/definitions/link"
							},
							"minItems": 1,
							"uniqueItems": true
						}
					}
				}
			]
		},
		"validFrom": {
			"type": "string",
			"pattern": "%s"
		},
		"validThrough": {
			"type": "string",
			"pattern": "%s"
		}
	},
	"required": ["@context", "@type", "licenseFor", "licenseHolder", "licenser", "validFrom", "validThrough"]
}`, SCHEMA, link, spec.CONTEXT, regex.DATE, regex.DATE))
View Source
var RecordingLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema":  "%s",
	"title": "MusicRecording",
	"type": "object",
	"definitions": {
		"link": %s,
		"party": {
			"allOf": [
				{
					"$ref": "#/definitions/link"
				},
				{
					"properties": {
						"hasLicense": {
							"$ref": "#/definitions/link"
						},
						"hasRight": {
							"$ref": "#/definitions/link"
						}
					}
				}
			]
		}
	},
	"properties": {
		"@context": {
			"type": "string",
			"pattern": "^%s$"
		},
		"@type": {
			"type": "string",
			"pattern": "^MusicRecording$"
		},
		"byArtist": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/party"
			},
			"minItems": 1,
			"uniqueItems": true
		},
		"duration": {
			"type": "string"			
		},
		"isrcCode": {
			"type": "string",
			"pattern": "%s"
		},
		"recordingOf": {
			"$ref": "#/definitions/link"
		},
		"recordLabel": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/party"
			},
			"minItems": 1,
			"uniqueItems": true
		},
		"url": {
			"type": "string"
		}
	},
	"required": ["@context", "@type", "byArtist", "recordingOf"]
}`, SCHEMA, link, spec.CONTEXT, regex.ISRC))
View Source
var RightLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "Right",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"@context": {
			"type": "string",
			"pattern": "^%s$"
		},
		"@type": {
			"type": "string",
			"pattern": "^Right$"
		},
		"rightHolder": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},
			"minItems": 1,
			"maxItems": 2,
			"uniqueItems": true
		},
		"rightTo": {
			"$ref": "#/definitions/link"
		},
		"transfer": {
			"$ref": "#/definitions/link"
		}
	},
	"required": ["@context", "@type", "rightHolder", "rightTo", "transfer"]
}`, SCHEMA, link, spec.CONTEXT))
View Source
var UserLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "User",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"@context": {
			"type": "string",
			"pattern": "^%s$"
		},
		"@type": {
			"type": "string",
			"pattern": "^MusicGroup|Organization|Person$"
		},
		"email": {
			"type": "string",
			"pattern": "%s"
		},
		"ipiNumber": {
			"type": "string",
			"pattern": "%s"
		},
		"isniNumber": {
			"type": "string",
			"pattern": "%s"
		},
		"member": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			},
			"minItems": 1,
			"uniqueItems": true
		},
		"name": {
			"type": "string"
		},
		"pro": {
			"type": "string",
			"pattern": "%s"
		},
		"sameAs": {
			"type": "string"
		}
	},
	"required": ["@context", "@type", "name", "sameAs"]
}`, SCHEMA, link, spec.CONTEXT, regex.EMAIL, regex.IPI, regex.ISNI, regex.PRO))

Functions

func ValidateSchema

func ValidateSchema(data Data, _type string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL