Last active
December 17, 2015 21:18
-
-
Save Dr-Emann/5673379 to your computer and use it in GitHub Desktop.
Haxelib.json schema. Written in [json-schema](http://json-schema.org/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"description": "A haxelib project", | |
"type": "object", | |
"properties": { | |
"name": { "$ref": "#/definitions/name" }, | |
"license": { | |
"description": "The open source license under which the project is licensed", | |
"enum": ["GPL", "LGPL", "BSD", "Public", "MIT"] | |
}, | |
"tags": { | |
"type": "array", | |
"items": { | |
"type": "string", | |
"minLength": 2 | |
}, | |
"uniqueItems": true | |
}, | |
"description": { | |
"type": "string", | |
"minLength": 2 | |
}, | |
"contributors": { | |
"type": "array", | |
"items": { "$ref": "#/definitions/name" }, | |
"minItems": 1, | |
"uniqueItems": true | |
}, | |
"releasenote": { | |
"type": "string", | |
"minLength": 2 | |
}, | |
"version": { "$ref": "#/definitions/semver" }, | |
"url": { | |
"type": "string", | |
"format": "uri" | |
}, | |
"dependencies": { | |
"type": "object", | |
"additionalProperties": { "$ref": "#/definitions/dependancyVersion" } | |
} | |
}, | |
"additionalProperties": false, | |
"required": ["name", "license", "description", "releasenote", "contributors", "version"], | |
"definitions": { | |
"name": { | |
"description": "The name of a haxelib project", | |
"type": "string", | |
"minLength": 3, | |
"pattern": "[A-Za-z0-9_.-]{3,}" | |
}, | |
"semver": { | |
"type": "string", | |
"pattern": "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-(alpha|beta|rc)(\\.([0-9]+))?)?$" | |
}, | |
"dependancyVersion": { | |
"oneOf": [ | |
{ "$ref": "#/definitions/semver" }, | |
{ | |
"type": "string", | |
"maxLength": 0 | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made a few changes, dependencies are allowed to use empty strings to not require a specific version and the regex for a haxelib project name used
-
in the wrong spot (it was being interpreted as a range, instead of a literal dash.I found a nice validator for javascript here. It looks like it wouldn't be too hard to port to Haxe, and it already supports v4 of the JSON-Schema.