-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
138 additions
and
28 deletions.
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,90 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://github.com/Mingun/structured-diff/blob/master/inline.schema.json", | ||
|
||
"oneOf": [ | ||
{ "$ref": "#/definitions/lines" }, | ||
{ "$ref": "#/definitions/hunks" } | ||
], | ||
|
||
"definitions": { | ||
"lines": { | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/lineChange" } | ||
}, | ||
"hunks": { | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/hunk" } | ||
}, | ||
|
||
"lineChange": { | ||
"description": "Object that describes one line of compared texts", | ||
"oneOf": [ | ||
{ "$ref": "#/definitions/changedLineWithInlineChanges" }, | ||
{ "$ref": "#/definitions/changedLineWithoutInlineChanges" }, | ||
{ "$ref": "#/definitions/unchangedLine" } | ||
] | ||
}, | ||
"changedLineWithInlineChanges": { | ||
"type": "object", | ||
"description": "Line that exist in both sides, but different in each other", | ||
"properties": { | ||
"kind": { "enum": ["?"] }, | ||
"changes": { | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/change" } | ||
} | ||
}, | ||
"required": ["kind", "changes"] | ||
}, | ||
"changedLineWithoutInlineChanges": { | ||
"type": "object", | ||
"description": "Line that just added or removed", | ||
"properties": { | ||
"kind": { "enum": ["+", "-"] }, | ||
"value": { | ||
"type": "string", | ||
"description": "Line part value that is the same in both sides" | ||
} | ||
}, | ||
"required": ["kind", "value"] | ||
}, | ||
"unchangedLine": { | ||
"type": "object", | ||
"description": "Line in the diff that is the same in both sides", | ||
"properties": { | ||
"kind": { "enum": [" "] }, | ||
"value": { | ||
"type": "string", | ||
"description": "Unchanged line content" | ||
} | ||
}, | ||
"required": ["kind", "value"] | ||
}, | ||
|
||
"change": { | ||
"type": "object", | ||
"description": "Represents inline change of the line", | ||
"properties": { | ||
"kind": { "enum": ["+", "-", " "] }, | ||
"value": { | ||
"type": "string", | ||
"description": "Part of line that added, removed or the same in both sides" | ||
} | ||
}, | ||
"required": ["kind", "value"] | ||
}, | ||
|
||
"hunk": { | ||
"type": "object", | ||
"properties": { | ||
"oldStart": { "type": "number", "minimum": 1 }, | ||
"oldLines": { "type": "number", "minimum": 0 }, | ||
"newStart": { "type": "number", "minimum": 1 }, | ||
"newLines": { "type": "number", "minimum": 0 }, | ||
"lines": { "$ref": "#/definitions/lines" } | ||
}, | ||
"required": ["oldStart", "oldLines", "newStart", "newLines", "lines"] | ||
} | ||
} | ||
} |
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
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