Commit 0e550529 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'fj-add-snippet-file-input-action' into 'master'

Add GraphQL snippet FileInputType

See merge request gitlab-org/gitlab!34442
parents 5877bea9 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
# 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
---
title: Add GraphQL snippet FileInputType
merge_request: 34442
author:
type: other
# 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
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment