Hello Fellas,
I am trying to use Open API Spex but as off this point with not much success.
I have been trying to define my schemass like following:
defmodule UserInstrument do
OpenApiSpex.schema(%{
title: "UserProfile",
description: "Just a user profile",
type: :object,
properties: %{
level: %Schema{type: :string, description: "The level of the user for the particular instrument"},
instrument: %Schema{type: :string, description: "The musical instrument name also unique idendifier for the instrument"}
},
required: [:level, :instrument],
example: %{
"level" => "V0",
"instrument" => "piano"
}
})
end
defmodule UserProfile do
OpenApiSpex.schema(%{
title: "UserProfile",
description: "Just a user profile",
type: :object,
properties: %{
email: %Schema{type: :string, description: "The user email"},
id: %Schema{type: :integer, description: "unique identifier"},
instruments: %Schema{type: :array, items: UserInstrument}
},
required: [:email, :id, :instruments],
example: %{
"id" => 12,
"email" => "someemail@server.com"
}
})
end
end
But somehow when I generate the schemas swagger fails to pick up the relationship between user profile and the instrument. This is also a problem when I am trying to do schema testing in my rest responses.
Am I missing something here ?
Or is this a bug of the implmentation library ?