Hi, I've used Swagger generator CLI and generated an API client for Java/Retrofit2. It successfully generated a complete project. But... There are at least 2 problems:
In the OAS json I've seen some definitions like
"$ref": "#/definitions/movie-list-result-object"
but they are only defined for few endpoints. Can I do something to generate a full and complete API client without?
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on March 3, 2017 at 10:39 AM
Hi @sevar83
You can read my reply from another user about this here: https://www.themoviedb.org/talk/58691a749251414e7500c442
Short version: It's because Stoplight is doing some custom things. We'll all have to bug them to get this improved
Reply by sevar83
on March 3, 2017 at 10:49 AM
Well, but I don't get any generator or compilation error. The problem is that the responses are inlined in the schema. They don't have names defined. So, the generator can't create Java model classes with meaningful names. I think the schema must have those "$ref": "#/definitions/model-xyz" for each response. Is that Stoplight filters this info by mistake or it's just not defined?
Reply by Travis Bell
on March 3, 2017 at 11:07 AM
Stoplight generates that 100%, so I'm not sure. I'll submit a support request with them and let you know what I find out.
Reply by sevar83
on March 3, 2017 at 11:11 AM
You may also provide this screenshot: http://imgur.com/a/91bII
Reply by Travis Bell
on March 3, 2017 at 12:01 PM
I'm working with Stoplight on this, they think they know the problem and to test the theory, what happens if you use this OAS file? Does it work?
Reply by sevar83
on March 3, 2017 at 12:03 PM
Great! I'll give it a try right now.
Reply by sevar83
on March 3, 2017 at 12:48 PM
There's some improvement but small. The model classes are still wrong named. The new oas.json has $refs on the parameters and error responses, but looks like it needs $refs on the status 200 responses to correctly name the models. I could send you a project that is fully set up. You just need to run "./run.sh" to start swagger codegen. Everything is configured. The included oas.json is the one you sent me. The output is also inlcluded. Which email to send it to?
Reply by justinhrobbins@gmail.com
on February 4, 2022 at 2:17 PM
I know this is an old post but just wanted to add that I'm also having difficulty generating clients from the Swagger (OAS) spec. I'm using OpenAPI Generator.
Reply by Travis Bell
on February 4, 2022 at 2:35 PM
Hi @justinhrobbins@gmail.com, the version of Stoplight we are using has been EOL'd. At some point in the near future we'll be migrating to a new platform but there's nothing that can be done about this in the currently state of the docs.
Reply by justinhrobbins@gmail.com
on February 4, 2022 at 2:51 PM
Thanks for the quick reply @travisbell. I'm a new user to TheMovieDb API and really appreciate your efforts. If/when there's a Trello issue for this I'll gladly give it an upvote. Thanks!
Reply by Chris9513
on March 18, 2022 at 11:06 AM
Those are great news @travisbell! Sincerely looking forward to using the API again without hacking the OAS 😊