schema

package
v0.0.0-...-b8806fc Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: MIT Imports: 3 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": {
		"composer": {
			"$ref": "#/definitions/link"
		},
		"hfaCode": {
			"type": "string",
			"pattern": "%s"
		},
		"inLanguage": {
			"type": "string",
			"pattern": "%s"
		},
		"iswcCode": {
			"type": "string",
			"pattern": "%s"
		},
		"name": {
			"type": "string"
		},
		"sameAs": {
			"type": "string"
		}
	},
	"required": ["composer", "name", "sameAs"]
}`, SCHEMA, link, regex.HFA, regex.LANGUAGE, regex.ISWC))
View Source
var CompositionRightTransferLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "CompositionRightTransfer",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"compositionRight": {
			"$ref": "#/definitions/link"
		},
		"publication": {
			"$ref": "#/definitions/link"
		},
		"recipient": {
			"$ref": "#/definitions/link"
		},
		"sender": {
			"$ref": "#/definitions/link"
		},
		"tx": {
			"$ref": "#/definitions/link"
		}
	},
	"required": ["compositionRight", "publication", "recipient", "sender", "tx"]
}`, SCHEMA, link))
View Source
var MasterLicenseLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "MasterLicense",
	"type": "object",
	"definitions": {
		"itemList": %s,
		"link": %s
	},
	"properties": {
		"recipient": {
			"$ref": "#/definitions/link"
		},
		"recording": {
			"$ref": "#/definitions/itemList"
		},
		"recordingRight": {
			"$ref": "#/definitions/link"
		},
		"recordingRightTransfer": {
			"$ref": "#/definitions/link"
		},
		"release": {
			"$ref": "#/definitions/link"
		},
		"sender": {
			"$ref": "#/definitions/link"
		},
		"territory": {
			"type": "array",
			"items": {
				"type": "string",
				"pattern": "%s"
			}
		},
		"usage": {
			"oneOf": [
				{
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				{
					"type": "null"
				}
			]
		},
		"validFrom": {
			"type": "string",
			"pattern": "%s"
		},
		"validThrough": {
			"type": "string",
			"pattern": "%s"
		}
	},
	"anyOf": [
		{
			"required": ["recording"]
		},
		{
			"required": ["release"]
		}
	],
	"dependencies": {
		"release": {
			"oneOf": [
				{
					"required": ["recordingRight"]
				},
				{
					"required": ["recordingRightTransfer"]
				}
			]
		}
	},
	"required": ["recipient", "sender", "territory", "usage", "validFrom", "validThrough"]
}`, SCHEMA, itemList, link, regex.TERRITORY, regex.DATE, regex.DATE))
View Source
var MechanicalLicenseLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "MechanicalLicense",
	"type": "object",
	"definitions": {
		"itemList": %s,
		"link": %s
	},
	"properties": {
		"composition": {
			"$ref": "#/definitions/itemList"
		},
		"compositionRight": {
			"$ref": "#/definitions/link"
		},
		"compositionRightTransfer": {
			"$ref": "#/definitions/link"
		},
		"publication": {
			"$ref": "#/definitions/link"
		},
		"recipient": {
			"$ref": "#/definitions/link"
		},
		"sender": {
			"$ref": "#/definitions/link"
		},
		"territory": {
			"type": "array",
			"items": {
				"type": "string",
				"pattern": "%s"
			}
		},
		"usage": {
			"oneOf": [
				{
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				{
					"type": "null"
				}
			]
		},
		"validFrom": {
			"type": "string",
			"pattern": "%s"
		},
		"validThrough": {
			"type": "string",
			"pattern": "%s"
		}
	},
	"anyOf": [
		{
			"required": ["composition"]
		},
		{
			"required": ["publication"]
		}
	],
	"dependencies": {
		"publication": {
			"oneOf": [
				{
					"required": ["compositionRight"]
				},
				{
					"required": ["compositionRightTransfer"]
				}
			]
		}
	},
	"required": ["recipient", "sender", "territory", "usage", "validFrom", "validThrough"]
}`, SCHEMA, itemList, link, regex.TERRITORY, regex.DATE, regex.DATE))
View Source
var PartyLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "Party",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"email": {
			"type": "string",
			"pattern": "%s"
		},
		"ipiNumber": {
			"type": "string",
			"pattern": "%s"
		},
		"isniNumber": {
			"type": "string",
			"pattern": "%s"
		},
		"member": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/link"
			}
		},
		"name": {
			"type": "string"
		},
		"pro": {
			"type": "string",
			"pattern": "%s"
		},
		"sameAs": {
			"type": "string"
		}
	},
	"required": ["email", "name", "sameAs"]
}`, SCHEMA, link, regex.EMAIL, regex.IPI, regex.ISNI, regex.PRO))
View Source
var PublicationLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "MusicPublication",
	"type": "object",
	"definitions": {
		"itemList": %s,
		"link": %s
	},
	"properties": {
		"composition": {
			"$ref": "#/definitions/itemList"
		},
		"compositionRight": {
			"$ref": "#/definitions/itemList"
		},
		"name": {
			"type": "string"
		},
		"publisher": {
			"$ref": "#/definitions/link"
		}
	},
	"required": ["composition", "compositionRight", "name"]
}`, SCHEMA, itemList, link))
View Source
var RecordingLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema":  "%s",
	"title": "MusicRecording",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"byArtist": {
			"$ref": "#/definitions/link"
		},
		"compositionRight": {
			"$ref": "#/definitions/link"
		},
		"duration": {
			"type": "string"			
		},
		"isrcCode": {
			"type": "string",
			"pattern": "%s"
		},
		"publication": {
			"$ref": "#/definitions/link"
		},
		"recordingOf": {
			"$ref": "#/definitions/link"
		}
	},
	"dependencies": {
		"compositionRight": ["publication"],
		"publication": ["compositionRight"]
	},
	"not": {
		"allOf": [
			{
				"required": ["compositionRight"]
			},
			{
				"required": ["mechanicalLicense"]
			}
		]
	},
	"required": ["byArtist", "duration", "recordingOf"]
}`, SCHEMA, link, regex.ISRC))
View Source
var RecordingRightTransferLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "RecordingRightTransfer",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"recipient": {
			"$ref": "#/definitions/link"
		},
		"recordingRight": {
			"$ref": "#/definitions/link"
		},
		"release": {
			"$ref": "#/definitions/link"
		},
		"sender": {
			"$ref": "#/definitions/link"
		},
		"tx": {
			"$ref": "#/definitions/link"
		}
	},
	"required": ["recipient", "recordingRight", "release", "sender", "tx"]
}`, SCHEMA, link))
View Source
var ReleaseLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema":  "%s",
	"title": "MusicRelease",
	"type": "object",
	"definitions": {
		"itemList": %s,
		"link": %s
	},
	"properties": {
		"name": {
			"type": "string"
		},
		"recording": {
			"$ref": "#/definitions/itemList"
		},
		"recordingRight": {
			"$ref": "#/definitions/itemList"
		},
		"recordLabel": {
			"$ref": "#/definitions/link"
		}
	},
	"required": ["name", "recording", "recordingRight"]
}`, SCHEMA, itemList, link))
View Source
var RightLoader = jsonschema.NewStringLoader(Sprintf(`{
	"$schema": "%s",
	"title": "Right",
	"type": "object",
	"definitions": {
		"link": %s
	},
	"properties": {
		"recipient": {
			"$ref": "#/definitions/link"
		},
		"sender": {
			"$ref": "#/definitions/link"
		},
		"territory": {
			"type": "array",
			"items": {
				"type": "string",
				"pattern": "%s"
			}
		},
		"validFrom": {
			"type": "string",
			"pattern": "%s"
		},
		"validThrough": {
			"type": "string",
			"pattern": "%s"
		}
	},
	"required": ["recipient", "sender", "territory", "validFrom", "validThrough"]
}`, SCHEMA, link, regex.TERRITORY, regex.DATE, regex.DATE))

Functions

func ValidateModel

func ValidateModel(model 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