-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
418de7a
commit 135c5ed
Showing
6 changed files
with
1,205 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
erlang 26.0.2 | ||
elixir 1.15.4-otp-26 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
defmodule AshJsonApiWrapper.OpenApi.PetstoreTest do | ||
use ExUnit.Case | ||
|
||
require Ash.Query | ||
|
||
@json "test/support/pet_store.json" |> File.read!() |> Jason.decode!() | ||
|
||
defmodule TestingTesla do | ||
use Tesla | ||
|
||
# plug(Tesla.Middleware.Headers, [ | ||
# {"authorization", "Bearer xxx"} | ||
# ]) | ||
end | ||
|
||
@config [ | ||
tesla: TestingTesla, | ||
endpoint: "https://petstore3.swagger.io/api/v3", | ||
resources: [ | ||
"Petstore.Order": [ | ||
path: "/store/order/{orderId}", | ||
object_type: "components.schemas.Order", | ||
primary_key: "id", | ||
# entity_path: "", | ||
fields: [ | ||
orderId: [ | ||
filter_handler: {:place_in_csv_list, ["id"]} | ||
] | ||
] | ||
] | ||
] | ||
] | ||
|
||
defmodule Api do | ||
use Ash.Api | ||
|
||
resources do | ||
allow_unregistered? true | ||
end | ||
end | ||
|
||
test "it does stuff" do | ||
@json | ||
|> AshJsonApiWrapper.OpenApi.ResourceGenerator.generate(@config) | ||
|> Enum.map(fn {resource, code} -> | ||
Code.eval_string(code) | ||
resource | ||
end) | ||
end | ||
end |
Oops, something went wrong.