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
mbuhot
Looks like those schemas have the same title. Try changing one and see if that fixes your issue.
1
Popular in Questions
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
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
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
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’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









