sangeethailango

sangeethailango

The open_api API documentation library is giving "internal server error"

I am trying to create an API documentation site for my API using the open_api library in my project. However, I am encountering an “Internal Server Error.”

I have created a GitHub repo to replicate the error:
GitHub repo: https://github.com/sangeethailango/project_management

After cloning the repo, go to http://localhost:4000/api/redoc to find the page where the error occurs.

The page loads fine if I remove the related(:users, :read) line in the accounts.ex domain file. However, the page fails to load when this line is present. For your information, I did not encounter any errors while creating the APIs, but the issue only occurs here.

Marked As Solved

shankardevy

shankardevy

It looks your user resource is two things:

  1. missing json_api declaration
  json_api do
    type("user")
  end
  1. and the use of extensions: [AshJsonApi.Resource]
  use Ash.Resource,
    domain: ProjectManagement.Account,
    data_layer: AshPostgres.DataLayer,
    extensions: [AshJsonApi.Resource]

Adding both should fix the error.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
minhajuddin
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
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

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gausby
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...
1207 40165 209
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement