-
Notifications
You must be signed in to change notification settings - Fork 16
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
Malformed swagger spec #19
Comments
I couldn't find where the spec is being generated in this repo, so for now I'm just going to hand-clean the currently hosted version. You can see that here for now. In cleaning this up I noticed that there is a mix of |
Update for anyone else that might want to auto-generate a client, I've cleaned up the spec a bit more and generated a go client using That's a good enough stopgap for now so I can continue moving forward on a GamesDBv2 migration, but generating a new client isn't easily sustainable when changes arise in the future. I'd still really like to see the source spec get fixed so manual cleanup isn't needed. I'm happy to try and assist if needed! |
@J-Swift thanks for this, I've finally had time to look into this, and I can see your swagger yaml working really well. I'm going to update our current reference to this.
if you have a suggestion as to how we can auto generate this properly, that will be appreciated, as we also currently have 1 undocumented api end point https://github.com/TheGamesDB/TheGamesDBv2/blob/dev/API/include/routes.php#L20 and this would be needed to ensure consistent/timely update as the API evolve. |
Auto generation is going to differ per platform. My knowledge is limited mostly to ruby, where there is a really good package that generates it based on your unit test suite (so that it gets programmatically verified). The other approach would be to invert the relationship of the system, and generate the server/clients from the spec. That's obviously a far reaching change, so don't think you necessarily would want to do that now but good to keep in mind for long term. This might work for you (I haven't looked too far into it): https://github.com/zircote/swagger-php If you are googling for packages, keep in mind that swagger is the old (v2) name. OpenApi is the new (v3+) name. I can try and update that endpoint in my spec for now though. I'll look into it tonight. |
@Zer0xFF - man, completely forgot about this! I am getting to this now to update for the new |
|
Interesting, I missed that in the original spec, and so the |
Doing a quick curl against current API looks like the responses are actually the same for both endpoints. Tested against these urls: https://api.thegamesdb.net/v1/Games/ByGameName?apikey=TMP_TEST_KEY&name=halo |
sorry for the delay, the issue is when you add |
OK, I think this is all updated then. I also added the |
auto generation isn't strictly required since we wont be making any breaking changes, but its a nice feature to have. |
I haven't looked too far into the underlying issue, but it looks like the swagger spec (https://api.thegamesdb.net/) references explicit items in the models. For example,
Publishers > Data > Publishers
has 4271 subobjects because it explicitly lists every single publisher.When trying to auto-generate API clients (e.g. using something like
openapi-generator
), this ends up with 12k files/types generated.Would it be possible to generalize the swagger definitions for the models so that the actual values aren't encoded into it? I really like that you are offering the swagger interface, and it will greatly ease migration from the old style clients if the swagger spec gets cleaned up.
Thanks!
The text was updated successfully, but these errors were encountered: