mirror of
https://github.com/ash-project/ash_json_api_wrapper.git
synced 2024-09-20 05:12:51 +12:00
chore: credo/ci
This commit is contained in:
parent
f91087bbb6
commit
e22fb218e8
9 changed files with 17 additions and 2 deletions
|
@ -123,7 +123,7 @@
|
||||||
{Credo.Check.Refactor.MatchInCondition, []},
|
{Credo.Check.Refactor.MatchInCondition, []},
|
||||||
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
|
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
|
||||||
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
|
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
|
||||||
{Credo.Check.Refactor.Nesting, [max_nesting: 6]},
|
{Credo.Check.Refactor.Nesting, [max_nesting: 8]},
|
||||||
{Credo.Check.Refactor.UnlessWithElse, []},
|
{Credo.Check.Refactor.UnlessWithElse, []},
|
||||||
{Credo.Check.Refactor.WithClauses, []},
|
{Credo.Check.Refactor.WithClauses, []},
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule AshJsonApiWrapper do
|
defmodule AshJsonApiWrapper do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
|
Functions for interacting with AshJsonApiWrapper changesets and queries.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@spec set_body_param(query_or_changeset, String.t(), any) :: query_or_changeset
|
@spec set_body_param(query_or_changeset, String.t(), any) :: query_or_changeset
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
defmodule AshJsonApiWrapper.DataLayer do
|
defmodule AshJsonApiWrapper.DataLayer do
|
||||||
|
@moduledoc """
|
||||||
|
A data layer for wrapping external JSON APIs.
|
||||||
|
"""
|
||||||
|
|
||||||
@field %Spark.Dsl.Entity{
|
@field %Spark.Dsl.Entity{
|
||||||
name: :field,
|
name: :field,
|
||||||
target: AshJsonApiWrapper.Field,
|
target: AshJsonApiWrapper.Field,
|
||||||
|
@ -127,6 +131,7 @@ defmodule AshJsonApiWrapper.DataLayer do
|
||||||
transformers: [AshJsonApiWrapper.DataLayer.Transformers.SetEndpointDefaults]
|
transformers: [AshJsonApiWrapper.DataLayer.Transformers.SetEndpointDefaults]
|
||||||
|
|
||||||
defmodule Query do
|
defmodule Query do
|
||||||
|
@moduledoc false
|
||||||
defstruct [
|
defstruct [
|
||||||
:api,
|
:api,
|
||||||
:context,
|
:context,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
defmodule AshJsonApiWrapper.DataLayer.Transformers.SetEndpointDefaults do
|
defmodule AshJsonApiWrapper.DataLayer.Transformers.SetEndpointDefaults do
|
||||||
|
@moduledoc false
|
||||||
use Spark.Dsl.Transformer
|
use Spark.Dsl.Transformer
|
||||||
|
|
||||||
alias Spark.Dsl.Transformer
|
alias Spark.Dsl.Transformer
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
defmodule AshJsonApiWrapper.DefaultTesla do
|
defmodule AshJsonApiWrapper.DefaultTesla do
|
||||||
|
@moduledoc """
|
||||||
|
A bare bones tesla implementation used by default if one is not provided.
|
||||||
|
"""
|
||||||
|
|
||||||
use Tesla
|
use Tesla
|
||||||
|
|
||||||
plug(Tesla.Middleware.FollowRedirects)
|
plug(Tesla.Middleware.FollowRedirects)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
defmodule AshJsonApiWrapper.Field do
|
defmodule AshJsonApiWrapper.Field do
|
||||||
|
@moduledoc "Represents a field mapped in the target api."
|
||||||
defstruct [:name, :path, :write_path, :filter_handler]
|
defstruct [:name, :path, :write_path, :filter_handler]
|
||||||
|
|
||||||
@type t :: %__MODULE__{}
|
@type t :: %__MODULE__{}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
defmodule AshJsonApiWrapper.OpenApi.ResourceGenerator do
|
defmodule AshJsonApiWrapper.OpenApi.ResourceGenerator do
|
||||||
|
@moduledoc "Generates resources from an open api specification"
|
||||||
|
|
||||||
def generate(json, main_config) do
|
def generate(json, main_config) do
|
||||||
main_config[:resources]
|
main_config[:resources]
|
||||||
|> Enum.map(fn {resource, config} ->
|
|> Enum.map(fn {resource, config} ->
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
defmodule AshJsonApiWrapper.Paginator.ContinuationProperty do
|
defmodule AshJsonApiWrapper.Paginator.ContinuationProperty do
|
||||||
|
@moduledoc "A paginator that uses a continuation property to paginate"
|
||||||
use AshJsonApiWrapper.Paginator
|
use AshJsonApiWrapper.Paginator
|
||||||
|
|
||||||
def continue(_response, [], _), do: :halt
|
def continue(_response, [], _), do: :halt
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -133,7 +133,7 @@ defmodule AshJsonApiWrapper.MixProject do
|
||||||
# Run "mix help deps" to learn about dependencies.
|
# Run "mix help deps" to learn about dependencies.
|
||||||
defp deps do
|
defp deps do
|
||||||
[
|
[
|
||||||
{:ash, "~> 2.15"},
|
{:ash, ash_version("~> 2.15")},
|
||||||
{:tesla, "~> 1.7"},
|
{:tesla, "~> 1.7"},
|
||||||
{:exjsonpath, "~> 0.1"},
|
{:exjsonpath, "~> 0.1"},
|
||||||
# Dev/Test dependencies
|
# Dev/Test dependencies
|
||||||
|
|
Loading…
Reference in a new issue