lib/schemas/repository/advisory/vulnerability.ex

defmodule GitHub.Repository.Advisory.Vulnerability do
  @moduledoc """
  Provides struct and type for RepositoryAdvisoryVulnerability
  """

  @type t :: %__MODULE__{
          package: map | nil,
          patched_versions: String.t() | nil,
          vulnerable_functions: [String.t()] | nil,
          vulnerable_version_range: String.t() | nil
        }

  defstruct [:package, :patched_versions, :vulnerable_functions, :vulnerable_version_range]

  @doc false
  @spec __fields__(atom) :: keyword
  def __fields__(type \\ :t)

  def __fields__(:t) do
    [
      package: {:nullable, :map},
      patched_versions: {:nullable, :string},
      vulnerable_functions: {:nullable, {:array, :string}},
      vulnerable_version_range: {:nullable, :string}
    ]
  end
end