Skip to content
pkm-uml-class-diagram-schema.json 2.73 KiB
Newer Older
{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://gitlab.ow2.org/decoder/pkm-api/-/tree/master/api/pkm-uml-class-diagram-schema.json",
	"title": "UML Class Diagram Schema - Version 1.0.0 JSON Schema.",
	"type": "object",
	"properties": {
		"type": {
			"type": "string"
		},
		"name": {
			"type": "string"
		},
		"diagram": {
			"type": "string"
		},
		"modules": {
			"$ref": "#/definitions/UmlModules"
		}
	},
	"required": [
		"type",
		"name",
		"modules"
	],
	"definitions": {
		"UmlModules": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlModule"
			}
		},
		"UmlModule": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"classes": {
					"$ref": "#/definitions/UmlClasses"
				},
				"associations": {
					"$ref": "#/definitions/UmlAssociations"
				}
			},
			"required": [
				"name",
				"classes"
			]
		},
		"UmlClasses": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlClass"
			}
		},
		"UmlClass": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"inherits": {
					"type": "array",
					"items": {
						"type": "object"
					}
				},
				"attributes": {
					"$ref": "#/definitions/UmlAttributes"
				},
				"operations": {
					"$ref": "#/definitions/UmlOperations"
				}
			},
			"required": [
				"name"
			]
		},
		"UmlAttributes": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlAttribute"
			}
		},
		"UmlAttribute": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"type": {
					"type": "string"
				}
			},
			"required": [
				"name",
				"type"
			]
		},
		"UmlOperations": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlOperation"
			}
		},
		"UmlOperation": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"returnType": {
					"type": "string"
				},
				"parameters": {
					"$ref": "#/definitions/UmlParameters"
				}
			},
			"anyOf": [
				{ "required" : [ "name" ] },
				{ "required" : [ "name", "returnType" ] },
				{ "required" : [ "name", "returnType", "parameters" ] }
			]
		},
		"UmlParameters": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlParameter"
			}
		},
		"UmlParameter": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"type": {
					"type": "string"
				}
			},
			"required": [
				"name"
			]
		},
		"UmlAssociations": {
			"type": "array",
			"items": {
				"$ref": "#/definitions/UmlAssociation"
			}
		},
		"UmlAssociation": {
			"type": "object",
			"properties": {
				"source": {
					"type": "string"
				},
				"target": {
					"type": "string"
				}
			},
			"required": [
				"source",
				"target"
			]
		}
	}
}