1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator do
8 alias Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsRepliesValidator
16 embeds_one(:replies, QuestionOptionsRepliesValidator)
20 def changeset(struct, data) do
22 |> cast(data, [:name, :type])
23 |> cast_embed(:replies)
24 |> validate_inclusion(:type, ["Note"])
25 |> validate_required([:name, :type])
29 defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsRepliesValidator do
37 field(:totalItems, :integer)
41 def changeset(struct, data) do
43 |> cast(data, __schema__(:fields))
44 |> validate_inclusion(:type, ["Collection"])
45 |> validate_required([:type])