Skip to content

Commit 6d2bb96

Browse files
committed
(#807) Add Swagger defs for envelope community config APIs
1 parent e882d3c commit 6d2bb96

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

lib/swagger_docs/models.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,55 @@ module Models # rubocop:todo Metrics/ModuleLength, Style/Documentation
512512
description: 'Context URL',
513513
type: :string
514514
end
515+
516+
swagger_schema :EnvelopeCommunityConfigChange do
517+
property :id,
518+
type: :number,
519+
description: 'ID of the change'
520+
property :changed_at,
521+
type: :number,
522+
format: :'date-time',
523+
description: 'Date and time of the change'
524+
525+
property :previous_version do
526+
key :type, :object
527+
key :description, 'Previous version'
528+
529+
property :description do
530+
key :type, :string
531+
key :description, 'Description of the previous version'
532+
end
533+
534+
property :payload do
535+
key :type, :object
536+
key :description, 'Payload of the previous version'
537+
end
538+
end
539+
540+
property :diff do
541+
key :type, :object
542+
543+
property :description do
544+
key :type, :array
545+
key :description, 'An array containing the previous and current description'
546+
key :minItems, 2
547+
key :maxItems, 2
548+
items do
549+
key :type, :string
550+
end
551+
end
552+
553+
property :payload do
554+
key :type, :array
555+
key :description, 'An array containing the previous and current payload'
556+
key :minItems, 2
557+
key :maxItems, 2
558+
items do
559+
key :type, :object
560+
end
561+
end
562+
end
563+
end
515564
end
516565
end
517566
end

lib/swagger_docs/sections/admin.rb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,77 @@ module Admin # rubocop:todo Metrics/ModuleLength, Style/Documentation
213213
end
214214
end
215215
end
216+
217+
swagger_path '/metadata/{community_name}/config' do
218+
operation :get do
219+
key :operationId, 'getApiConfig'
220+
key :description, "Get the envelope community's config"
221+
key :produces, ['application/json']
222+
key :tags, ['Admin']
223+
224+
parameter community_name
225+
226+
response 200 do
227+
key :description, "The envelope community's config"
228+
key :type, :object
229+
end
230+
end
231+
232+
operation :post do
233+
key :operationId, 'postApiConfig'
234+
key :description, 'Uploads a config for the envelope community'
235+
key :produces, ['application/json']
236+
key :tags, ['Admin']
237+
238+
parameter community_name
239+
240+
parameter do
241+
key :name, :body
242+
key :in, :body
243+
key :description, 'JSON object containing a config and its description'
244+
key :required, true
245+
246+
schema do
247+
key :required, %i[description payload]
248+
249+
property :description do
250+
key :type, :string
251+
key :description, 'Config description'
252+
end
253+
254+
property :payload do
255+
key :type, :object
256+
key :description, 'Config payload'
257+
end
258+
end
259+
end
260+
261+
response 201 do
262+
key :description, 'Config uploaded'
263+
key :type, :object
264+
end
265+
end
266+
end
267+
268+
swagger_path '/metadata/{community_name}/config/changes' do
269+
operation :get do
270+
key :operationId, 'getApiConfigChanges'
271+
key :description, "Get the changes to the envelope community's config"
272+
key :produces, ['application/json']
273+
key :tags, ['Admin']
274+
275+
parameter community_name
276+
277+
response 200 do
278+
key :description, "The changes to the envelope community's config"
279+
280+
schema do
281+
key :type, :array
282+
items { key :$ref, :EnvelopeCommunityConfigChange }
283+
end
284+
end
285+
end
286+
end
216287
end
217288
end
218289
end

0 commit comments

Comments
 (0)