Add OpenAPI schema for FlakeID
This commit is contained in:
parent
f0238d010a
commit
11433cd38d
5 changed files with 24 additions and 21 deletions
|
@ -6,7 +6,9 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.AccountField
|
alias Pleroma.Web.ApiSpec.Schemas.AccountField
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.ActorType
|
alias Pleroma.Web.ApiSpec.Schemas.ActorType
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
|
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
|
||||||
|
|
||||||
require OpenApiSpex
|
require OpenApiSpex
|
||||||
|
@ -29,7 +31,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
following_count: %Schema{type: :integer},
|
following_count: %Schema{type: :integer},
|
||||||
header_static: %Schema{type: :string, format: :uri},
|
header_static: %Schema{type: :string, format: :uri},
|
||||||
header: %Schema{type: :string, format: :uri},
|
header: %Schema{type: :string, format: :uri},
|
||||||
id: %Schema{type: :string},
|
id: FlakeID,
|
||||||
locked: %Schema{type: :boolean},
|
locked: %Schema{type: :boolean},
|
||||||
note: %Schema{type: :string, format: :html},
|
note: %Schema{type: :string, format: :html},
|
||||||
statuses_count: %Schema{type: :integer},
|
statuses_count: %Schema{type: :integer},
|
||||||
|
@ -62,23 +64,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
privacy_option: %Schema{type: :boolean}
|
privacy_option: %Schema{type: :boolean}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
relationship: %Schema{
|
relationship: AccountRelationship,
|
||||||
type: :object,
|
|
||||||
properties: %{
|
|
||||||
blocked_by: %Schema{type: :boolean},
|
|
||||||
blocking: %Schema{type: :boolean},
|
|
||||||
domain_blocking: %Schema{type: :boolean},
|
|
||||||
endorsed: %Schema{type: :boolean},
|
|
||||||
followed_by: %Schema{type: :boolean},
|
|
||||||
following: %Schema{type: :boolean},
|
|
||||||
id: %Schema{type: :string},
|
|
||||||
muting: %Schema{type: :boolean},
|
|
||||||
muting_notifications: %Schema{type: :boolean},
|
|
||||||
requested: %Schema{type: :boolean},
|
|
||||||
showing_reblogs: %Schema{type: :boolean},
|
|
||||||
subscribing: %Schema{type: :boolean}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
settings_store: %Schema{
|
settings_store: %Schema{
|
||||||
type: :object
|
type: :object
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do
|
defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
|
||||||
|
|
||||||
require OpenApiSpex
|
require OpenApiSpex
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do
|
||||||
endorsed: %Schema{type: :boolean},
|
endorsed: %Schema{type: :boolean},
|
||||||
followed_by: %Schema{type: :boolean},
|
followed_by: %Schema{type: :boolean},
|
||||||
following: %Schema{type: :boolean},
|
following: %Schema{type: :boolean},
|
||||||
id: %Schema{type: :string},
|
id: FlakeID,
|
||||||
muting: %Schema{type: :boolean},
|
muting: %Schema{type: :boolean},
|
||||||
muting_notifications: %Schema{type: :boolean},
|
muting_notifications: %Schema{type: :boolean},
|
||||||
requested: %Schema{type: :boolean},
|
requested: %Schema{type: :boolean},
|
||||||
|
|
14
lib/pleroma/web/api_spec/schemas/flake_id.ex
Normal file
14
lib/pleroma/web/api_spec/schemas/flake_id.ex
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# 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.Schemas.FlakeID do
|
||||||
|
require OpenApiSpex
|
||||||
|
|
||||||
|
OpenApiSpex.schema(%{
|
||||||
|
title: "FlakeID",
|
||||||
|
description:
|
||||||
|
"Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However just like Mastodon's ids they are sortable strings",
|
||||||
|
type: :string
|
||||||
|
})
|
||||||
|
end
|
|
@ -5,6 +5,7 @@
|
||||||
defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
|
||||||
|
|
||||||
require OpenApiSpex
|
require OpenApiSpex
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
||||||
description: "Response schema for account custom fields",
|
description: "Response schema for account custom fields",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
id: %Schema{type: :string},
|
id: FlakeID,
|
||||||
expires_at: %Schema{type: :string, format: "date-time"},
|
expires_at: %Schema{type: :string, format: "date-time"},
|
||||||
expired: %Schema{type: :boolean},
|
expired: %Schema{type: :boolean},
|
||||||
multiple: %Schema{type: :boolean},
|
multiple: %Schema{type: :boolean},
|
||||||
|
|
|
@ -6,6 +6,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
alias OpenApiSpex.Schema
|
alias OpenApiSpex.Schema
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.Account
|
alias Pleroma.Web.ApiSpec.Schemas.Account
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
alias Pleroma.Web.ApiSpec.Schemas.AccountEmoji
|
||||||
|
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.Poll
|
alias Pleroma.Web.ApiSpec.Schemas.Poll
|
||||||
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
|
alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
emojis: %Schema{type: :array, items: AccountEmoji},
|
emojis: %Schema{type: :array, items: AccountEmoji},
|
||||||
favourited: %Schema{type: :boolean},
|
favourited: %Schema{type: :boolean},
|
||||||
favourites_count: %Schema{type: :integer},
|
favourites_count: %Schema{type: :integer},
|
||||||
id: %Schema{type: :string},
|
id: FlakeID,
|
||||||
in_reply_to_account_id: %Schema{type: :string, nullable: true},
|
in_reply_to_account_id: %Schema{type: :string, nullable: true},
|
||||||
in_reply_to_id: %Schema{type: :string, nullable: true},
|
in_reply_to_id: %Schema{type: :string, nullable: true},
|
||||||
language: %Schema{type: :string, nullable: true},
|
language: %Schema{type: :string, nullable: true},
|
||||||
|
|
Loading…
Reference in a new issue