Skip to content

Commit d2f0347

Browse files
committed
#51 part 1 — drop JSON:API surface
* removed direct :ash_json_api dep, the AshJsonApi.Domain extension, the json_api do ... routes block on Nbn, and json_api blocks / AshJsonApi.Resource extensions on all NBN resources * deleted lib/nbn/api_router.ex * router now serves /catalog + /mcp only; everything else 404s * MCP becomes the only externally-callable surface * 54/54 tests pass
1 parent 390dcb3 commit d2f0347

14 files changed

Lines changed: 8 additions & 129 deletions

File tree

config/config.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ config :spark,
1616
:characteristics,
1717
:neo4j,
1818
:jason,
19-
:json_api,
2019
:outstanding,
2120
:actions,
2221
:state_machine,

lib/nbn/api_router.ex

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

lib/nbn/nbn.ex

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule DiffoExample.Nbn do
1515
use Ash.Domain,
1616
otp_app: :diffo,
1717
fragments: [Diffo.Provider.DomainFragment],
18-
extensions: [AshAi, AshJsonApi.Domain]
18+
extensions: [AshAi]
1919

2020
alias DiffoExample.Nbn.NbnEthernet
2121
alias DiffoExample.Nbn.Uni
@@ -86,77 +86,6 @@ defmodule DiffoExample.Nbn do
8686
tool :deactivate_rsp, Rsp, :deactivate
8787
end
8888

89-
json_api do
90-
routes do
91-
base_route "/nbnEthernet", NbnEthernet do
92-
index :read
93-
get :read
94-
post :build
95-
patch :define
96-
patch :relate, route: "/:id/relate"
97-
delete :destroy
98-
end
99-
100-
base_route "/uni", Uni do
101-
index :read
102-
get :read
103-
post :build
104-
patch :define
105-
patch :relate, route: "/:id/relate"
106-
delete :destroy
107-
end
108-
109-
base_route "/avc", Avc do
110-
index :read
111-
get :read
112-
post :build
113-
patch :define
114-
patch :relate, route: "/:id/relate"
115-
delete :destroy
116-
end
117-
118-
base_route "/ntd", Ntd do
119-
index :read
120-
get :read
121-
post :build
122-
patch :define
123-
patch :relate, route: "/:id/relate"
124-
delete :destroy
125-
end
126-
127-
base_route "/cvc", Cvc do
128-
index :read
129-
get :read
130-
post :build
131-
patch :define
132-
patch :relate, route: "/:id/relate"
133-
delete :destroy
134-
end
135-
136-
base_route "/nniGroup", NniGroup do
137-
index :read
138-
get :read
139-
post :build
140-
patch :define
141-
patch :relate, route: "/:id/relate"
142-
delete :destroy
143-
end
144-
145-
base_route "/nni", Nni do
146-
index :read
147-
get :read
148-
post :build
149-
patch :define
150-
patch :relate, route: "/:id/relate"
151-
delete :destroy
152-
end
153-
154-
base_route "/rsp", Rsp do
155-
get :read
156-
end
157-
end
158-
end
159-
16089
resources do
16190
resource NbnEthernet do
16291
define :get_nbn_ethernet_by_id, action: :read, get_by: :id

lib/nbn/resources/avc.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ defmodule DiffoExample.Nbn.Avc do
1919
use Ash.Resource,
2020
fragments: [BaseInstance],
2121
domain: Nbn,
22-
extensions: [AshJsonApi.Resource],
2322
authorizers: [Ash.Policy.Authorizer]
2423

2524
resource do
2625
description "An Ash Resource representing an Access Virtual Circuit (AVC)"
2726
plural_name :Avcs
2827
end
2928

30-
json_api do
31-
type "avc"
32-
end
33-
3429
provider do
3530
specification do
3631
id "b2c3d4e5-6f7a-4b8c-9d0e-1f2a3b4c5d6e"

lib/nbn/resources/cvc.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@ defmodule DiffoExample.Nbn.Cvc do
2020
use Ash.Resource,
2121
fragments: [BaseInstance],
2222
domain: Nbn,
23-
extensions: [AshJsonApi.Resource],
2423
authorizers: [Ash.Policy.Authorizer]
2524

2625
resource do
2726
description "An Ash Resource representing a Connectivity Virtual Circuit (CVC)"
2827
plural_name :Cvcs
2928
end
3029

31-
json_api do
32-
type "cvc"
33-
end
34-
3530
provider do
3631
specification do
3732
id "d4e5f6a7-8b9c-4d0e-bf1a-3b4c5d6e7f8a"

lib/nbn/resources/nbn_ethernet.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ defmodule DiffoExample.Nbn.NbnEthernet do
1818
use Ash.Resource,
1919
fragments: [BaseInstance],
2020
domain: Nbn,
21-
extensions: [AshJsonApi.Resource],
2221
authorizers: [Ash.Policy.Authorizer]
2322

2423
resource do
2524
description "An Ash Resource representing an NBN Ethernet access"
2625
plural_name :NbnEthernets
2726
end
2827

29-
json_api do
30-
type "nbnEthernet"
31-
end
32-
3328
provider do
3429
specification do
3530
id "f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c"

lib/nbn/resources/nni.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@ defmodule DiffoExample.Nbn.Nni do
2020
use Ash.Resource,
2121
fragments: [BaseInstance],
2222
domain: Nbn,
23-
extensions: [AshJsonApi.Resource],
2423
authorizers: [Ash.Policy.Authorizer]
2524

2625
resource do
2726
description "An Ash Resource representing a Network-to-Network Interface (NNI)"
2827
plural_name :Nnis
2928
end
3029

31-
json_api do
32-
type "nni"
33-
end
34-
3530
provider do
3631
specification do
3732
id "f6a7b8c9-0d1e-4f2a-9b3c-5d6e7f8a9b0c"

lib/nbn/resources/nni_group.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ defmodule DiffoExample.Nbn.NniGroup do
2121
use Ash.Resource,
2222
fragments: [BaseInstance],
2323
domain: Nbn,
24-
extensions: [AshJsonApi.Resource],
2524
authorizers: [Ash.Policy.Authorizer]
2625

2726
resource do
2827
description "An Ash Resource representing an NNI Group"
2928
plural_name :NniGroups
3029
end
3130

32-
json_api do
33-
type "nniGroup"
34-
end
35-
3631
provider do
3732
specification do
3833
id "e5f6a7b8-9c0d-4e1f-8a2b-4c5d6e7f8a9b"

lib/nbn/resources/ntd.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ defmodule DiffoExample.Nbn.Ntd do
2020
use Ash.Resource,
2121
fragments: [BaseInstance],
2222
domain: Nbn,
23-
extensions: [AshJsonApi.Resource],
2423
authorizers: [Ash.Policy.Authorizer]
2524

2625
resource do
@@ -71,10 +70,6 @@ defmodule DiffoExample.Nbn.Ntd do
7170
end
7271
end
7372

74-
json_api do
75-
type "ntd"
76-
end
77-
7873
def identifier() do
7974
DiffoExample.Nbn.Util.identifier("NTD")
8075
end

lib/nbn/resources/rsp.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule DiffoExample.Nbn.Rsp do
2020
use Ash.Resource,
2121
domain: Nbn,
2222
authorizers: [Ash.Policy.Authorizer],
23-
extensions: [AshStateMachine, AshJsonApi.Resource],
23+
extensions: [AshStateMachine],
2424
fragments: [Diffo.Provider.BaseParty]
2525

2626
policies do
@@ -58,10 +58,6 @@ defmodule DiffoExample.Nbn.Rsp do
5858
# actions: :read (primary), :destroy, :create (accept [:id,:name,:type,:referred_type]),
5959
# :update (name), :list (unsorted), :find_by_name
6060

61-
json_api do
62-
type "rsp"
63-
end
64-
6561
provider do
6662
instances do
6763
role :owns_avc, DiffoExample.Nbn.Avc

0 commit comments

Comments
 (0)