Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F114975
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/open_api_spex/inspect/for_schema.ex b/lib/open_api_spex/inspect/for_schema.ex
new file mode 100644
index 0000000..d363528
--- /dev/null
+++ b/lib/open_api_spex/inspect/for_schema.ex
@@ -0,0 +1,16 @@
+defimpl Inspect, for: OpenApiSpex.Schema do
+ import Inspect.Algebra
+
+ def inspect(parameter, opts) do
+ map =
+ parameter
+ |> Map.from_struct()
+ |> Enum.filter(fn
+ {_key, nil} -> false
+ {_key, _value} -> true
+ end)
+ |> Map.new()
+
+ concat(["%OpenApiSpex.Schema", to_doc(map, opts)])
+ end
+end
diff --git a/test/inspect/for_schema_test.exs b/test/inspect/for_schema_test.exs
new file mode 100644
index 0000000..c8d2130
--- /dev/null
+++ b/test/inspect/for_schema_test.exs
@@ -0,0 +1,10 @@
+defmodule OpenApiSpex.Inspect.ForSchemaTest do
+ use ExUnit.Case, async: true
+ alias OpenApiSpex.Schema
+
+ test "inspect schema" do
+ schema = %Schema{title: "Hello"}
+ output = inspect(schema)
+ assert output == "%OpenApiSpex.Schema%{title: \"Hello\"}"
+ end
+end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 26, 9:46 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40492
Default Alt Text
(1 KB)
Attached To
Mode
R22 open_api_spex
Attached
Detach File
Event Timeline
Log In to Comment