-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot generate files #27
Comments
That's not great. Could you link me to the spec you're using? Just want to make sure I try the exact same file. Thanks! |
https://github.com/discord/discord-api-spec/blob/main/specs/openapi.json At peak its taking about 64gb of ram and I think a bit of swap |
The good news is, I can replicate the issue. The bad news is, it still happens in the latest release candidate. Out of sheer curiosity, I let it run for a while to see if it would eventually terminate — after 112Gb of RAM, it still wasn't done. This suggests that there is a cycle in the referenced schemas (ex. users have teams, and teams have users) and the generator doesn't detect the duplication. Looking into this further. |
It looks like the Discord OpenAPI spec has this little gem: {
"components": {
"schemas": {
"ErrorDetails": {
"oneOf": [
{
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/ErrorDetails"
}
},
{
"$ref": "#/components/schemas/InnerErrors"
}
]
}
}
}
} To be honest, I'm not sure what the resulting code should look like in this scenario. Their Postman collection seems to allow for any arbitrary JSON with this. There is a (rather big) problem with the generator and how it (doesn't) handle cycles in the spec, which I'm working to resolve now. However, it might be worth finding out what Discord's intent with this field is. |
Version |
This worked pretty well! Hopefully gonna save me a lot of time with my lib. One thing I maybe suggest is adding more logs that way people know stuff is happening instead of just waiting there. How do the api endpoints work? I see something about a client but I couldnt find a client file generated, do I have to make one myself? |
I also believe that error schema just means it can be nested of itself? Very strange struct but could just be represented by |
We should definitely be able to include the %{optional(String.t()) => t()} | InnerError.t() |
Quick update for anyone watching: Version |
Experimenting with this library using the discord api spec. I run the
mix api.gen default ...
command and after a while nothing happens but I get this error:fish: Job 1, 'mix api.gen default openapi3_1.…' terminated by signal SIGKILL (Forced quit)
One thing I notice is that my mem usage goes to 100%, its possible BEAM is just taking all of my memory up because of how big the discord spec is.
The text was updated successfully, but these errors were encountered: