Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

959 B
Raw Blame
defmodule PlausibleWeb.Plugins.API.Schemas.Goal.CustomEvent do
  @moduledoc """
  OpenAPI schema for Custom Event Goal object
  """
  use PlausibleWeb, :open_api_schema

  alias Schemas.Goal.CustomProps

  OpenApiSpex.schema(%{
    description: "Custom Event Goal object",
    title: "Goal.CustomEvent",
    type: :object,
    allOf: [
      Schemas.Goal.Type,
      %Schema{
        type: :object,
        required: [:goal],
        properties: %{
          goal: %Schema{
            type: :object,
            required: [:id, :display_name, :event_name],
            properties: %{
              id: %Schema{type: :integer, description: "Goal ID", readOnly: true},
              display_name: %Schema{type: :string, description: "Display name", readOnly: true},
              event_name: %Schema{type: :string, description: "Event Name"},
              custom_props: CustomProps.response_schema()
            }
          }
        }
      }
    ]
  })
end