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
81f142da
Commit
81f142da
authored
Jun 12, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GraphQL snippet FileInputType
parent
6c09ab66
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
0 deletions
+72
-0
app/graphql/types/snippets/file_input_action_enum.rb
app/graphql/types/snippets/file_input_action_enum.rb
+15
-0
app/graphql/types/snippets/file_input_type.rb
app/graphql/types/snippets/file_input_type.rb
+26
-0
changelogs/unreleased/fj-add-snippet-file-input-action.yml
changelogs/unreleased/fj-add-snippet-file-input-action.yml
+5
-0
spec/graphql/types/snippets/file_input_action_enum_spec.rb
spec/graphql/types/snippets/file_input_action_enum_spec.rb
+11
-0
spec/graphql/types/snippets/file_input_type_spec.rb
spec/graphql/types/snippets/file_input_type_spec.rb
+15
-0
No files found.
app/graphql/types/snippets/file_input_action_enum.rb
0 → 100644
View file @
81f142da
# frozen_string_literal: true
module
Types
module
Snippets
class
FileInputActionEnum
<
BaseEnum
graphql_name
'SnippetFileInputActionEnum'
description
'Type of a snippet file input action'
value
'create'
,
value: :create
value
'update'
,
value: :update
value
'delete'
,
value: :delete
value
'move'
,
value: :move
end
end
end
app/graphql/types/snippets/file_input_type.rb
0 → 100644
View file @
81f142da
# frozen_string_literal: true
module
Types
module
Snippets
class
FileInputType
<
BaseInputObject
# rubocop:disable Graphql/AuthorizeTypes
graphql_name
'SnippetFileInputType'
description
'Represents an action to perform over a snippet file'
argument
:action
,
Types
::
Snippets
::
FileInputActionEnum
,
description:
'Type of input action'
,
required:
true
argument
:previous_path
,
GraphQL
::
STRING_TYPE
,
description:
'Previous path of the snippet file'
,
required:
false
argument
:file_path
,
GraphQL
::
STRING_TYPE
,
description:
'Path of the snippet file'
,
required:
true
argument
:content
,
GraphQL
::
STRING_TYPE
,
description:
'Snippet file content'
,
required:
false
end
end
end
changelogs/unreleased/fj-add-snippet-file-input-action.yml
0 → 100644
View file @
81f142da
---
title
:
Add GraphQL snippet FileInputType
merge_request
:
34442
author
:
type
:
other
spec/graphql/types/snippets/file_input_action_enum_spec.rb
0 → 100644
View file @
81f142da
# frozen_string_literal: true
require
'spec_helper'
describe
Types
::
Snippets
::
FileInputActionEnum
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'SnippetFileInputActionEnum'
)
}
it
'exposes all file input action types'
do
expect
(
described_class
.
values
.
keys
).
to
eq
(
%w[create update delete move]
)
end
end
spec/graphql/types/snippets/file_input_type_spec.rb
0 → 100644
View file @
81f142da
# frozen_string_literal: true
require
'spec_helper'
describe
Types
::
Snippets
::
FileInputType
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'SnippetFileInputType'
)
}
it
'has the correct arguments'
do
expect
(
described_class
.
arguments
.
keys
).
to
match_array
(
%w[filePath action previousPath content]
)
end
it
'sets the type of action argument to FileInputActionEnum'
do
expect
(
described_class
.
arguments
[
'action'
].
type
.
of_type
).
to
eq
(
Types
::
Snippets
::
FileInputActionEnum
)
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