Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F12552707
boolean_like.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
904 B
Referenced Files
None
Subscribers
None
boolean_like.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.ApiSpec.Schemas.BooleanLike
do
alias
OpenApiSpex.Cast
alias
OpenApiSpex.Schema
require
OpenApiSpex
OpenApiSpex
.
schema
(%{
title
:
"BooleanLike"
,
description
:
"""
The following values will be treated as `false`:
- false
- 0
- "0",
- "f",
- "F",
- "false",
- "FALSE",
- "off",
- "OFF"
All other non-null values will be treated as `true`
"""
,
anyOf
:
[
%
Schema
{
type
:
:boolean
},
%
Schema
{
type
:
:string
},
%
Schema
{
type
:
:integer
}
],
"x-validate"
:
__MODULE__
})
def
cast
(%
Cast
{
value
:
value
}
=
context
)
do
context
|>
Map
.
put
(
:value
,
Pleroma.Web.Utils.Params
.
truthy_param?
(
value
))
|>
Cast
.
ok
()
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Nov 15, 1:03 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
632235
Default Alt Text
boolean_like.ex (904 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment