Skip to content

Commit 4d44ec5

Browse files
Merge pull request #28 from diffo-dev/16-typed-struct-extensions
16 typed struct extensions
2 parents 0d6846b + 3652ee3 commit 4d44ec5

22 files changed

Lines changed: 93 additions & 311 deletions

File tree

lib/ash_jason/typed_struct.ex

Lines changed: 0 additions & 146 deletions
This file was deleted.

lib/ash_jason/typed_struct/transformer.ex

Lines changed: 0 additions & 142 deletions
This file was deleted.

lib/diffo/access/assigner/assignable_value.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ defmodule Diffo.Access.AssignableValue do
88

99
jason do
1010
pick [:first, :last, :free, :type, :algorithm]
11+
compact true
1112
end
1213

1314
typed_struct do

lib/diffo/access/assigner/assignment.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ defmodule Diffo.Access.Assignment do
88

99
jason do
1010
pick [:id, :assignee_id, :operation]
11+
compact true
1112
end
1213

1314
typed_struct do

lib/diffo/access/resources/characteristic_values/cable_value.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ defmodule Diffo.Access.CableValue do
44
55
CableValue - AshTyped Struct for Cable Characteristic Value
66
"""
7-
use Ash.TypedStruct, extensions: [AshJason.TypedStruct]
7+
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
88

99
jason do
1010
pick [:name, :pairs, :length, :loss, :technology]
11+
compact true
12+
end
13+
14+
outstanding do
15+
expect [:pairs, :loss]
1116
end
1217

1318
typed_struct do

lib/diffo/access/resources/characteristic_values/card_value.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ defmodule Diffo.Access.CardValue do
44
55
CardValue - AshTyped Struct for Card Characteristic Value
66
"""
7-
use Ash.TypedStruct, extensions: [AshJason.TypedStruct]
7+
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
88

99
jason do
1010
pick [:name, :family, :model, :technology]
11+
compact true
1112
end
1213

14+
outstanding do
15+
expect [:name]
16+
end
17+
18+
1319
typed_struct do
1420
field :name, :string, description: "the card name"
1521

lib/diffo/access/resources/characteristic_values/float_unit.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ defmodule Diffo.Access.FloatUnit do
44
55
FloatUnit - AshTyped Struct for Float with Unit
66
"""
7-
use Ash.TypedStruct, extensions: [AshJason.TypedStruct]
7+
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
88

99
jason do
1010
pick [:amount, :unit]
11+
compact true
12+
end
13+
14+
outstanding do
15+
expect [:amount, :unit]
1116
end
1217

1318
typed_struct do

lib/diffo/access/resources/characteristic_values/integer_unit.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ defmodule Diffo.Access.IntegerUnit do
44
55
IntegerUnit - AshTyped Struct for Integer with Unit
66
"""
7-
use Ash.TypedStruct, extensions: [AshJason.TypedStruct]
7+
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
88

99
jason do
1010
pick [:amount, :unit]
11+
compact true
12+
end
13+
14+
outstanding do
15+
expect [:amount, :unit]
1116
end
1217

1318
typed_struct do

lib/diffo/access/resources/characteristic_values/path_value.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ defmodule Diffo.Access.PathValue do
44
55
PathValue - AshTyped Struct for Path Characteristic Value
66
"""
7-
use Ash.TypedStruct, extensions: [AshJason.TypedStruct]
7+
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
88

99
jason do
1010
pick [:name, :sections, :length, :loss, :technology]
11+
compact true
12+
end
13+
14+
outstanding do
15+
expect [:loss]
1116
end
1217

1318
typed_struct do

0 commit comments

Comments
 (0)