nikolis
Open Api Specs problem
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 ?
Most Liked Responses
mbuhot
Looks like those schemas have the same title. Try changing one and see if that fixes your issue.
1
Popular in Questions
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Other popular topics
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
Hello, how can I check the Phoenix version ?
Thanks !
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New








