mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 10:43:44 +08:00
19089f21d2
This commit adds API documentation for the new upload endpoints related to direct + multipart external uploads. Also included is a rake task which watches the files in the spec/requests/api directory and calls a script file (spec/regenerate_swagger_docs) whenever one changes. This script runs rake rswag:specs:swaggerize and then copies the openapi.yml file over to the discourse_api_docs repo directory, and hits a script there to convert the YML to JSON so the API docs are refreshed while the server is still running. This makes the loop of making a doc change and seeing it in the local server much faster. The rake task is rake autospec:swagger
30 lines
1.0 KiB
Ruby
30 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
Fabricator(:external_upload_stub) do
|
|
transient :folder_prefix
|
|
|
|
created_by { Fabricate(:user) }
|
|
original_filename "test.txt"
|
|
key { |attrs| FileStore::BaseStore.temporary_upload_path("test.txt", folder_prefix: attrs[:folder_prefix] || "") }
|
|
upload_type "card_background"
|
|
filesize 1024
|
|
status 1
|
|
end
|
|
|
|
Fabricator(:image_external_upload_stub, from: :external_upload_stub) do
|
|
original_filename "logo.png"
|
|
filesize 1024
|
|
key { |attrs| FileStore::BaseStore.temporary_upload_path("logo.png", folder_prefix: attrs[:folder_prefix] || "") }
|
|
end
|
|
|
|
Fabricator(:attachment_external_upload_stub, from: :external_upload_stub) do
|
|
original_filename "file.pdf"
|
|
filesize 1024
|
|
key { |attrs| FileStore::BaseStore.temporary_upload_path("file.pdf", folder_prefix: attrs[:folder_prefix] || "") }
|
|
end
|
|
|
|
Fabricator(:multipart_external_upload_stub, from: :external_upload_stub) do
|
|
multipart true
|
|
external_upload_identifier { "#{SecureRandom.hex(6)}._#{SecureRandom.hex(6)}_#{SecureRandom.hex(6)}.d.ghQ" }
|
|
end
|