-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial JSON schema #58
Open
nick7
wants to merge
1
commit into
sannybuilder:master
Choose a base branch
from
nick7:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema", | ||
"type": "object", | ||
"properties": { | ||
"$schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"patternProperties": { | ||
"^[A-Z0-9][A-Za-z0-9_]+$": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^[A-Z0-9][A-Za-z0-9_]+$": { | ||
"anyOf": [ | ||
{ | ||
"type": "null" | ||
}, | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "integer" | ||
} | ||
] | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalItems": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema", | ||
"definitions": { | ||
"url": { | ||
"type": "string", | ||
"pattern": "^(http|https|ftp)://([a-zA-Z\\.\\d/#?=%+_]+)$" | ||
}, | ||
"type_name": { | ||
"description": "CamelCase type name", | ||
"type": "string", | ||
"pattern": "^[A-Z][a-zA-Z0-9]+$" | ||
}, | ||
"extension": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"pattern": "^[a-zA-Z0-9_\\-]+$" | ||
}, | ||
"commands": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/command" | ||
} | ||
} | ||
}, | ||
"required": [ "name", "commands" ], | ||
"additionalProperties": false | ||
}, | ||
"command": { | ||
"description": "Command definition", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"description": "Opcode unique identifier", | ||
"type": "string", | ||
"pattern": "^[0-9a-fA-F]{4}$" | ||
}, | ||
"name": { | ||
"description": "Opcode unique name (Rockstar fashion)", | ||
"pattern": "^([A-Z0-9_]+|{|})$" | ||
}, | ||
"num_params": { | ||
"description": "Total parameter count", | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 20 | ||
}, | ||
"input": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/command_parameter" | ||
} | ||
}, | ||
"output": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/command_parameter" | ||
} | ||
}, | ||
"short_desc": { | ||
"type": "string" | ||
}, | ||
"attrs": { | ||
"$ref": "#/definitions/command_attributes" | ||
}, | ||
"class": { | ||
"type": "string" | ||
}, | ||
"member": { | ||
"type": "string" | ||
}, | ||
"platforms": { | ||
"type": "array" | ||
}, | ||
"versions": { | ||
"type": "array" | ||
} | ||
}, | ||
"required": [ "id", "name", "num_params" ], | ||
"additionalProperties": false | ||
}, | ||
"command_parameter": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"pattern": "^([a-zA-Z_0-9]+|)$" | ||
}, | ||
"type": { | ||
"$ref": "#/definitions/parameter_type" | ||
}, | ||
"source": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ "name", "type" ], | ||
"additionalProperties": false | ||
}, | ||
"command_attributes": { | ||
"description": "Command attributes", | ||
"type": "object", | ||
"properties": { | ||
"is_branch": { | ||
"description": "This command branches the code", | ||
"type": "boolean" | ||
}, | ||
"is_condition": { | ||
"description": "This command can be used in conditional statements", | ||
"type": "boolean" | ||
}, | ||
"is_constructor": { | ||
"description": "This command creates a new in-game entity", | ||
"type": "boolean" | ||
}, | ||
"is_destructor": { | ||
"description": "This command deletes the in-game entity", | ||
"type": "boolean" | ||
}, | ||
"is_keyword": { | ||
"description": "This command is used as a single keyword followed by arguments", | ||
"type": "boolean" | ||
}, | ||
"is_nop": { | ||
"description": "This command is a no-operation", | ||
"type": "boolean" | ||
}, | ||
"is_overload": { | ||
"description": "This command has multiple variations for different types of arguments", | ||
"type": "boolean" | ||
}, | ||
"is_segment": { | ||
"description": "This command is used to separate segments in SCM header", | ||
"type": "boolean" | ||
}, | ||
"is_static": { | ||
"description": "This command operates on a static property or in-game entity that can not be constructed dynamically", | ||
"type": "boolean" | ||
}, | ||
"is_unsupported": { | ||
"description": "This command is unsupported in the given game and its usage is forbidden", | ||
"type": "boolean" | ||
}, | ||
"is_variadic": { | ||
"description": "This command has variadic number of arguments", | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"parameter_type": { | ||
"anyOf": [ | ||
{ | ||
"description": "Basic type", | ||
"enum": [ | ||
"any", | ||
"arguments", | ||
"bool", | ||
"script_id", | ||
"float", | ||
"gxt_key", | ||
"int", | ||
"label", | ||
"model_any", | ||
"model_char", | ||
"model_object", | ||
"model_vehicle", | ||
"string", | ||
"string128", | ||
"zone_key" | ||
] | ||
}, | ||
{ | ||
"description": "Enumeration name", | ||
"$ref": "#/definitions/type_name" | ||
} | ||
] | ||
}, | ||
"class": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "Class name", | ||
"$ref": "#/definitions/type_name" | ||
}, | ||
"constructable": { | ||
"type": "boolean" | ||
}, | ||
"desc": { | ||
"type": "string" | ||
}, | ||
"extends": { | ||
"$ref": "#/definitions/type_name" | ||
} | ||
}, | ||
"required": [ "name", "constructable", "desc" ], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"$schema": { | ||
"type": "string" | ||
}, | ||
"meta": { | ||
"description": "Meta-information", | ||
"type": "object", | ||
"properties": { | ||
"last_update": { | ||
"description": "Timestamp", | ||
"type": "integer" | ||
}, | ||
"version": { | ||
"type": "string", | ||
"pattern": "^[\\d\\.]+$" | ||
}, | ||
"url": { | ||
"$ref": "#/definitions/url" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"extensions": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/extension" | ||
} | ||
}, | ||
"classes": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/class" | ||
} | ||
} | ||
}, | ||
"required": [ "meta", "extensions" ], | ||
"additionalProperties": false | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maximum is unset, however normally it would be 16 params in 3/VC and 32 in San Andreas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, it's my mistake. It should be increased. I wanted to add reasonable limit to make schema stronger.