Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
443ac5e8
Commit
443ac5e8
authored
Mar 14, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce diff with CE in spec/fixtures/api/schemas
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
46521de2
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
285 additions
and
187 deletions
+285
-187
ee/spec/fixtures/api/schemas/board.json
ee/spec/fixtures/api/schemas/board.json
+25
-0
ee/spec/fixtures/api/schemas/boards.json
ee/spec/fixtures/api/schemas/boards.json
+4
-0
ee/spec/fixtures/api/schemas/entities/issue.json
ee/spec/fixtures/api/schemas/entities/issue.json
+11
-0
ee/spec/fixtures/api/schemas/entities/issue_boards.json
ee/spec/fixtures/api/schemas/entities/issue_boards.json
+14
-0
ee/spec/fixtures/api/schemas/entities/merge_request_widget.json
...c/fixtures/api/schemas/entities/merge_request_widget.json
+28
-0
ee/spec/fixtures/api/schemas/issue.json
ee/spec/fixtures/api/schemas/issue.json
+11
-0
ee/spec/fixtures/api/schemas/issues.json
ee/spec/fixtures/api/schemas/issues.json
+14
-0
ee/spec/fixtures/api/schemas/public_api/v4/epic_issue_link.json
...c/fixtures/api/schemas/public_api/v4/epic_issue_link.json
+1
-1
ee/spec/fixtures/api/schemas/public_api/v4/epic_issues.json
ee/spec/fixtures/api/schemas/public_api/v4/epic_issues.json
+1
-0
ee/spec/fixtures/api/schemas/public_api/v4/issues.json
ee/spec/fixtures/api/schemas/public_api/v4/issues.json
+1
-0
ee/spec/fixtures/api/schemas/public_api/v4/merge_request.json
...pec/fixtures/api/schemas/public_api/v4/merge_request.json
+14
-0
ee/spec/fixtures/api/schemas/public_api/v4/merge_requests.json
...ec/fixtures/api/schemas/public_api/v4/merge_requests.json
+4
-0
spec/fixtures/api/schemas/board.json
spec/fixtures/api/schemas/board.json
+3
-18
spec/fixtures/api/schemas/entities/issue.json
spec/fixtures/api/schemas/entities/issue.json
+1
-3
spec/fixtures/api/schemas/entities/issue_boards.json
spec/fixtures/api/schemas/entities/issue_boards.json
+3
-6
spec/fixtures/api/schemas/entities/merge_request_widget.json
spec/fixtures/api/schemas/entities/merge_request_widget.json
+2
-23
spec/fixtures/api/schemas/issue.json
spec/fixtures/api/schemas/issue.json
+1
-3
spec/fixtures/api/schemas/issues.json
spec/fixtures/api/schemas/issues.json
+3
-6
spec/fixtures/api/schemas/public_api/v4/merge_request.json
spec/fixtures/api/schemas/public_api/v4/merge_request.json
+124
-0
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
+1
-122
spec/support/api/schema_matcher.rb
spec/support/api/schema_matcher.rb
+19
-5
No files found.
ee/spec/fixtures/api/schemas/board.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../spec/fixtures/api/schemas/board.json"
},
{
"required"
:
[
"name"
],
"properties"
:
{
"board_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
],
"required"
:
[
"id"
,
"title"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
}
}
}
}
}
]
}
ee/spec/fixtures/api/schemas/boards.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"./board.json"
}
}
ee/spec/fixtures/api/schemas/entities/issue.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../spec/fixtures/api/schemas/entities/issue.json"
},
{
"properties"
:
{
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
}
}
}
]
}
ee/spec/fixtures/api/schemas/entities/issue_boards.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../spec/fixtures/api/schemas/entities/issue_boards.json"
},
{
"required"
:
[
"total_weight"
],
"properties"
:
{
"total_weight"
:
{
"type"
:
"integer"
}
}
}
]
}
ee/spec/fixtures/api/schemas/entities/merge_request_widget.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../spec/fixtures/api/schemas/entities/merge_request_widget.json"
},
{
"properties"
:
{
"has_approvals_available"
:
{
"type"
:
[
"boolean"
]
},
"approvals_before_merge"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"approved"
:
{
"type"
:
"boolean"
},
"approvals_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approvals_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approval_settings_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approve_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_unapprove_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"codeclimate"
:
{
"head_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
}
},
"blob_path"
:
{
"head_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
}
},
"vulnerability_feedback_path"
:
{
"type"
:
"string"
},
"can_create_feedback"
:
{
"type"
:
"boolean"
}
}
}
]
}
ee/spec/fixtures/api/schemas/issue.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../spec/fixtures/api/schemas/issue.json"
},
{
"properties"
:
{
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
}
}
}
]
}
ee/spec/fixtures/api/schemas/issues.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../spec/fixtures/api/schemas/issues.json"
},
{
"required"
:
[
"total_weight"
],
"properties"
:
{
"total_weight"
:
{
"type"
:
"integer"
}
}
}
]
}
ee/spec/fixtures/api/schemas/public_api/v4/epic_issue_link.json
View file @
443ac5e8
...
...
@@ -6,7 +6,7 @@
"issue"
:
{
"type"
:
"object"
},
"epic"
:
{
"allOf"
:
[
{
"$ref"
:
".
./../../../../../../ee/spec/fixtures/api/schemas/public_api/v4
/epic.json"
}
{
"$ref"
:
"./epic.json"
}
]
},
"issue"
:
{
...
...
ee/spec/fixtures/api/schemas/public_api/v4/epic_issues.json
View file @
443ac5e8
{
"type"
:
"array"
,
"allOf"
:
[
{
"$ref"
:
"./issues.json"
},
{
...
...
ee/spec/fixtures/api/schemas/public_api/v4/issues.json
View file @
443ac5e8
{
"type"
:
"array"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../../spec/fixtures/api/schemas/public_api/v4/issues.json"
},
{
...
...
ee/spec/fixtures/api/schemas/public_api/v4/merge_request.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"../../../../../../../spec/fixtures/api/schemas/public_api/v4/merge_request.json"
},
{
"required"
:
[
"approvals_before_merge"
],
"properties"
:
{
"approvals_before_merge"
:
{
"type"
:
[
"integer"
,
"null"
]
}
}
}
]
}
ee/spec/fixtures/api/schemas/public_api/v4/merge_requests.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"./merge_request.json"
}
}
spec/fixtures/api/schemas/board.json
View file @
443ac5e8
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"name"
"id"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"board_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
],
"required"
:
[
"id"
,
"title"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
},
"additionalProperties"
:
false
"name"
:
{
"type"
:
"string"
}
}
}
spec/fixtures/api/schemas/entities/issue.json
View file @
443ac5e8
...
...
@@ -10,7 +10,6 @@
"title"
:
{
"type"
:
"string"
},
"moved_to_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"project_id"
:
{
"type"
:
"integer"
},
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"web_url"
:
{
"type"
:
"string"
},
"state"
:
{
"type"
:
"string"
},
"create_note_path"
:
{
"type"
:
"string"
},
...
...
@@ -39,6 +38,5 @@
"items"
:
{
"$ref"
:
"label.json"
}
},
"assignees"
:
{
"type"
:
[
"array"
,
"null"
]
}
},
"additionalProperties"
:
false
}
}
spec/fixtures/api/schemas/entities/issue_boards.json
View file @
443ac5e8
...
...
@@ -2,16 +2,13 @@
"type"
:
"object"
,
"required"
:
[
"issues"
,
"size"
,
"total_weight"
"size"
],
"properties"
:
{
"issues"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"issue_board.json"
}
},
"size"
:
{
"type"
:
"integer"
},
"total_weight"
:
{
"type"
:
"integer"
}
},
"additionalProperties"
:
false
"size"
:
{
"type"
:
"integer"
}
}
}
spec/fixtures/api/schemas/entities/merge_request_widget.json
View file @
443ac5e8
...
...
@@ -125,27 +125,6 @@
"test_reports_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"can_receive_suggestion"
:
{
"type"
:
"boolean"
},
"source_branch_protected"
:
{
"type"
:
"boolean"
},
"conflicts_docs_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
//
EE-specific
"has_approvals_available"
:
{
"type"
:
[
"boolean"
]
},
"approvals_before_merge"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"approved"
:
{
"type"
:
"boolean"
},
"approvals_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approvals_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approval_settings_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_approve_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"api_unapprove_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"codeclimate"
:
{
"head_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
}
},
"blob_path"
:
{
"head_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
}
},
"vulnerability_feedback_path"
:
{
"type"
:
"string"
},
"can_create_feedback"
:
{
"type"
:
"boolean"
}
},
"additionalProperties"
:
false
"conflicts_docs_path"
:
{
"type"
:
[
"string"
,
"null"
]
}
}
}
spec/fixtures/api/schemas/issue.json
View file @
443ac5e8
...
...
@@ -9,7 +9,6 @@
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"weight"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"title"
:
{
"type"
:
"string"
},
"confidential"
:
{
"type"
:
"boolean"
},
"due_date"
:
{
"type"
:
[
"date"
,
"null"
]
},
...
...
@@ -53,6 +52,5 @@
}
},
"subscribed"
:
{
"type"
:
[
"boolean"
,
"null"
]
}
},
"additionalProperties"
:
false
}
}
spec/fixtures/api/schemas/issues.json
View file @
443ac5e8
...
...
@@ -2,16 +2,13 @@
"type"
:
"object"
,
"required"
:
[
"issues"
,
"size"
,
"total_weight"
"size"
],
"properties"
:
{
"issues"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"issue.json"
}
},
"size"
:
{
"type"
:
"integer"
},
"total_weight"
:
{
"type"
:
"integer"
}
},
"additionalProperties"
:
false
"size"
:
{
"type"
:
"integer"
}
}
}
spec/fixtures/api/schemas/public_api/v4/merge_request.json
0 → 100644
View file @
443ac5e8
{
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"merged_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"merged_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"closed_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"closed_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"target_branch"
:
{
"type"
:
"string"
},
"source_branch"
:
{
"type"
:
"string"
},
"upvotes"
:
{
"type"
:
"integer"
},
"downvotes"
:
{
"type"
:
"integer"
},
"author"
:
{
"type"
:
"object"
,
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"assignee"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"source_project_id"
:
{
"type"
:
"integer"
},
"target_project_id"
:
{
"type"
:
"integer"
},
"labels"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"string"
}
},
"work_in_progress"
:
{
"type"
:
"boolean"
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"group_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"due_date"
:
{
"type"
:
"date"
},
"start_date"
:
{
"type"
:
"date"
}
},
"additionalProperties"
:
false
},
"merge_when_pipeline_succeeds"
:
{
"type"
:
"boolean"
},
"merge_status"
:
{
"type"
:
"string"
},
"sha"
:
{
"type"
:
"string"
},
"merge_commit_sha"
:
{
"type"
:
[
"string"
,
"null"
]
},
"user_notes_count"
:
{
"type"
:
"integer"
},
"changes_count"
:
{
"type"
:
"string"
},
"should_remove_source_branch"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"force_remove_source_branch"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"discussion_locked"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"web_url"
:
{
"type"
:
"uri"
},
"squash"
:
{
"type"
:
"boolean"
},
"time_stats"
:
{
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"string"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"string"
,
"null"
]
}
},
"allow_collaboration"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"allow_maintainer_to_push"
:
{
"type"
:
[
"boolean"
,
"null"
]
}
},
"required"
:
[
"id"
,
"iid"
,
"project_id"
,
"title"
,
"description"
,
"state"
,
"created_at"
,
"updated_at"
,
"target_branch"
,
"source_branch"
,
"upvotes"
,
"downvotes"
,
"author"
,
"assignee"
,
"source_project_id"
,
"target_project_id"
,
"labels"
,
"work_in_progress"
,
"milestone"
,
"merge_when_pipeline_succeeds"
,
"merge_status"
,
"sha"
,
"merge_commit_sha"
,
"user_notes_count"
,
"should_remove_source_branch"
,
"force_remove_source_branch"
,
"web_url"
,
"squash"
]
}
}
spec/fixtures/api/schemas/public_api/v4/merge_requests.json
View file @
443ac5e8
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"merged_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"merged_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"closed_by"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"closed_at"
:
{
"type"
:
[
"date"
,
"null"
]
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"target_branch"
:
{
"type"
:
"string"
},
"source_branch"
:
{
"type"
:
"string"
},
"upvotes"
:
{
"type"
:
"integer"
},
"downvotes"
:
{
"type"
:
"integer"
},
"author"
:
{
"type"
:
"object"
,
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"assignee"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"username"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"state"
:
{
"type"
:
"string"
},
"avatar_url"
:
{
"type"
:
"uri"
},
"web_url"
:
{
"type"
:
"uri"
}
},
"additionalProperties"
:
false
},
"source_project_id"
:
{
"type"
:
"integer"
},
"target_project_id"
:
{
"type"
:
"integer"
},
"labels"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"string"
}
},
"work_in_progress"
:
{
"type"
:
"boolean"
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"group_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"due_date"
:
{
"type"
:
"date"
},
"start_date"
:
{
"type"
:
"date"
}
},
"additionalProperties"
:
false
},
"merge_when_pipeline_succeeds"
:
{
"type"
:
"boolean"
},
"merge_status"
:
{
"type"
:
"string"
},
"sha"
:
{
"type"
:
"string"
},
"merge_commit_sha"
:
{
"type"
:
[
"string"
,
"null"
]
},
"user_notes_count"
:
{
"type"
:
"integer"
},
"changes_count"
:
{
"type"
:
"string"
},
"should_remove_source_branch"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"force_remove_source_branch"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"discussion_locked"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"web_url"
:
{
"type"
:
"uri"
},
"approvals_before_merge"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"squash"
:
{
"type"
:
"boolean"
},
"time_stats"
:
{
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"string"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"string"
,
"null"
]
}
},
"allow_collaboration"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"allow_maintainer_to_push"
:
{
"type"
:
[
"boolean"
,
"null"
]
}
},
"required"
:
[
"id"
,
"iid"
,
"project_id"
,
"title"
,
"description"
,
"state"
,
"created_at"
,
"updated_at"
,
"target_branch"
,
"source_branch"
,
"upvotes"
,
"downvotes"
,
"author"
,
"assignee"
,
"source_project_id"
,
"target_project_id"
,
"labels"
,
"work_in_progress"
,
"milestone"
,
"merge_when_pipeline_succeeds"
,
"merge_status"
,
"sha"
,
"merge_commit_sha"
,
"user_notes_count"
,
"should_remove_source_branch"
,
"force_remove_source_branch"
,
"web_url"
,
"approvals_before_merge"
,
"squash"
],
"additionalProperties"
:
false
"$ref"
:
"./merge_request.json"
}
}
spec/support/api/schema_matcher.rb
View file @
443ac5e8
module
SchemaPath
def
self
.
expand
(
schema
,
dir
=
''
)
Rails
.
root
.
join
(
dir
,
'spec'
,
"fixtures/api/schemas/
#{
schema
}
.json"
).
to_s
def
self
.
expand
(
schema
,
dir
=
nil
)
if
Gitlab
.
ee?
&&
dir
.
nil?
ee_path
=
expand
(
schema
,
'ee'
)
return
ee_path
if
File
.
exist?
(
ee_path
)
end
Rails
.
root
.
join
(
dir
.
to_s
,
'spec'
,
"fixtures/api/schemas/
#{
schema
}
.json"
).
to_s
end
end
RSpec
::
Matchers
.
define
:match_response_schema
do
|
schema
,
dir:
''
,
**
options
|
RSpec
::
Matchers
.
define
:match_response_schema
do
|
schema
,
dir:
nil
,
**
options
|
match
do
|
response
|
@errors
=
JSON
::
Validator
.
fully_validate
(
SchemaPath
.
expand
(
schema
,
dir
),
response
.
body
,
options
)
...
...
@@ -18,8 +24,16 @@ RSpec::Matchers.define :match_response_schema do |schema, dir: '', **options|
end
end
RSpec
::
Matchers
.
define
:match_schema
do
|
schema
,
dir:
''
,
**
options
|
RSpec
::
Matchers
.
define
:match_schema
do
|
schema
,
dir:
nil
,
**
options
|
match
do
|
data
|
JSON
::
Validator
.
validate!
(
SchemaPath
.
expand
(
schema
,
dir
),
data
,
options
)
@errors
=
JSON
::
Validator
.
fully_validate
(
SchemaPath
.
expand
(
schema
,
dir
),
data
,
options
)
@errors
.
empty?
end
failure_message
do
|
response
|
"didn't match the schema defined by
#{
SchemaPath
.
expand
(
schema
,
dir
)
}
"
\
" The validation errors were:
\n
#{
@errors
.
join
(
"
\n
"
)
}
"
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment