File size: 1,326 Bytes
936b397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | defmodule PlausibleWeb.Plugins.API.Schemas.Funnel do
@moduledoc """
OpenAPI schema for Funnel
"""
use Plausible.Funnel.Const
use PlausibleWeb, :open_api_schema
OpenApiSpex.schema(%{
title: "Funnel",
description: "Funnel object",
type: :object,
properties: %{
funnel: %Schema{
type: :object,
required: [:id, :name, :steps],
properties: %{
id: %Schema{type: :integer, description: "Funnel ID"},
name: %Schema{type: :string, description: "Name"},
steps: %Schema{
description: "Funnel Steps",
type: :array,
minItems: 2,
maxItems: Funnel.Const.max_steps(),
items: Schemas.Goal
}
}
}
},
example: %{
funnel: %{
id: 123,
name: "My Marketing Funnel",
steps: [
%{
goal_type: "Goal.Pageview",
goal: %{
id: 1,
display_name: "Visit /product/1",
path: "/product/1"
}
},
%{
goal_type: "Goal.Revenue",
goal: %{
id: 2,
display_name: "Purchase",
currency: "EUR",
event_name: "Purchase"
}
}
]
}
}
})
end
|