1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator do
15 embeds_one :replies, Replies, primary_key: false do
16 field(:totalItems, :integer)
23 def changeset(struct, data) do
25 |> cast(data, [:name, :type])
26 |> cast_embed(:replies, with: &replies_changeset/2)
27 |> validate_inclusion(:type, ["Note"])
28 |> validate_required([:name, :type])
31 def replies_changeset(struct, data) do
33 |> cast(data, [:totalItems, :type])
34 |> validate_inclusion(:type, ["Collection"])
35 |> validate_required([:type])