mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: Add site.json to api docs (#14249)
Documenting the site.json api endpoint. This endpoint is often used as a way to get all of the categories and subcategories in a single api call.
This commit is contained in:
34
spec/requests/api/site_spec.rb
Normal file
34
spec/requests/api/site_spec.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
require 'swagger_helper'
|
||||
|
||||
describe 'site' do
|
||||
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
before do
|
||||
Jobs.run_immediately!
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
path '/site.json' do
|
||||
|
||||
get 'Get site info' do
|
||||
tags 'Site', 'Categories'
|
||||
operationId 'getSite'
|
||||
description 'Can be used to fetch all categories and subcategories'
|
||||
consumes 'application/json'
|
||||
expected_request_schema = nil
|
||||
|
||||
produces 'application/json'
|
||||
response '200', 'success response' do
|
||||
expected_response_schema = load_spec_schema('site_response')
|
||||
schema expected_response_schema
|
||||
|
||||
it_behaves_like "a JSON endpoint", 200 do
|
||||
let(:expected_response_schema) { expected_response_schema }
|
||||
let(:expected_request_schema) { expected_request_schema }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user