File size: 1,063 Bytes
88211d3 | 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 | defmodule PlausibleWeb.Plugins.API.Schemas.Goal.CreateRequest do
@moduledoc """
OpenAPI schema for Goal creation request
"""
use Plausible.Funnel.Const
use PlausibleWeb, :open_api_schema
OpenApiSpex.schema(%{
title: "Goal.CreateRequest",
description: "Goal creation params",
type: :object,
oneOf: [
%Schema{
title: "Goal.CreateRequest.BulkGetOrCreate",
type: :object,
description: "Bulk goal creation request",
required: [:goals],
properties: %{
goals: %Schema{
type: :array,
minItems: 1,
maxItems: Funnel.Const.max_steps(),
items: %Schema{
oneOf: [
Schemas.Goal.CreateRequest.CustomEvent,
Schemas.Goal.CreateRequest.Revenue,
Schemas.Goal.CreateRequest.Pageview
]
}
}
}
},
Schemas.Goal.CreateRequest.CustomEvent,
Schemas.Goal.CreateRequest.Revenue,
Schemas.Goal.CreateRequest.Pageview
]
})
end
|