Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions lib/ash/code_interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ defmodule Ash.CodeInterface do

#{interface_options.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()
@doc spark_opts: [
{opts_location, interface_options.schema()}
]
Expand Down Expand Up @@ -531,7 +531,7 @@ defmodule Ash.CodeInterface do

#{interface_options.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()
@doc spark_opts: [
{opts_location, interface_options.schema()}
]
Expand Down Expand Up @@ -1651,7 +1651,7 @@ defmodule Ash.CodeInterface do

#{interface_options.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()

@doc spark_opts: [
{first_opts_location, interface_options.schema()},
Expand Down Expand Up @@ -1683,7 +1683,7 @@ defmodule Ash.CodeInterface do

#{interface_options.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()

@doc spark_opts: [
{first_opts_location, interface_options.schema()},
Expand Down Expand Up @@ -1728,7 +1728,7 @@ defmodule Ash.CodeInterface do

#{Spark.Options.docs(subject_opts)}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()
@doc spark_opts: [
{first_opts_location, subject_opts},
{first_opts_location + 1, subject_opts}
Expand All @@ -1754,7 +1754,7 @@ defmodule Ash.CodeInterface do

#{Ash.Resource.Interface.CanOpts.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()
@dialyzer {:nowarn_function, {:"can_#{interface.name}", length(common_args) + 3}}
@doc spark_opts: [
{first_opts_location + 1, Ash.Resource.Interface.CanOpts.schema()},
Expand Down Expand Up @@ -1842,7 +1842,7 @@ defmodule Ash.CodeInterface do

#{Ash.Resource.Interface.CanQuestionMarkOpts.docs()}
"""
|> Ash.CodeInterface.trim_double_newlines()
|> Ash.CodeInterface.trim_triple_newlines()
def unquote(:"can_#{interface.name}?")(
actor,
unquote_splicing(common_args),
Expand Down Expand Up @@ -2306,6 +2306,12 @@ defmodule Ash.CodeInterface do
|> String.trim_trailing()
end

def trim_triple_newlines(str) do
str
|> String.replace(~r/\n{3,}/, "\n\n")
|> String.trim_trailing()
end

@doc false
def bulk_query(resource, method, id) do
case method do
Expand Down
Loading