Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alex Gleason
pleroma
Commits
03eebabe
Verified
Commit
03eebabe
authored
5 years ago
by
minibikini
Browse files
Options
Downloads
Patches
Plain Diff
Add Pleroma.Web.ApiSpec.Helpers
parent
0aa24a15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pleroma/web/api_spec/helpers.ex
+27
-0
27 additions, 0 deletions
lib/pleroma/web/api_spec/helpers.ex
lib/pleroma/web/api_spec/operations/app_operation.ex
+2
-2
2 additions, 2 deletions
lib/pleroma/web/api_spec/operations/app_operation.ex
with
29 additions
and
2 deletions
lib/pleroma/web/api_spec/helpers.ex
0 → 100644
+
27
−
0
View file @
03eebabe
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma
.
Web
.
ApiSpec
.
Helpers
do
def
request_body
(
description
,
schema_ref
,
opts
\\
[])
do
media_types
=
[
"application/json"
,
"multipart/form-data"
]
content
=
media_types
|>
Enum
.
map
(
fn
type
->
{
type
,
%
OpenApiSpex
.
MediaType
{
schema:
schema_ref
,
example:
opts
[
:example
],
examples:
opts
[
:examples
]
}}
end
)
|>
Enum
.
into
(%{})
%
OpenApiSpex
.
RequestBody
{
description:
description
,
content:
content
,
required:
opts
[
:required
]
||
false
}
end
end
This diff is collapsed.
Click to expand it.
lib/pleroma/web/api_spec/operations/app_operation.ex
+
2
−
2
View file @
03eebabe
...
...
@@ -5,6 +5,7 @@
defmodule
Pleroma
.
Web
.
ApiSpec
.
AppOperation
do
alias
OpenApiSpex
.
Operation
alias
OpenApiSpex
.
Schema
alias
Pleroma
.
Web
.
ApiSpec
.
Helpers
alias
Pleroma
.
Web
.
ApiSpec
.
Schemas
.
AppCreateRequest
alias
Pleroma
.
Web
.
ApiSpec
.
Schemas
.
AppCreateResponse
...
...
@@ -21,8 +22,7 @@ def create_operation do
summary:
"Create an application"
,
description:
"Create a new application to obtain OAuth2 credentials"
,
operationId:
"AppController.create"
,
requestBody:
Operation
.
request_body
(
"Parameters"
,
"application/json"
,
AppCreateRequest
,
required:
true
),
requestBody:
Helpers
.
request_body
(
"Parameters"
,
AppCreateRequest
,
required:
true
),
responses:
%{
200
=>
Operation
.
response
(
"App"
,
"application/json"
,
AppCreateResponse
),
422
=>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment