Universalis icon indicating copy to clipboard operation
Universalis copied to clipboard

WIP: API Client Generation

Open sciku1 opened this issue 2 years ago • 2 comments

I added an example with python and javascript, in the Dockerfile during the swagger-codegen stage the libraries get created in the format /clients/{lang} so /clients/javascript and /clients/python are added for now (I haven't tested the JS one).

I ended up needing to make some dependencies be loaded by generator functions rather than in the initialization. For example sc.AddSingleton<IMongoClient>(new MongoClient(configuration["MongoDbConnectionString"])); sc.AddSingleton<IMongoClient>(_ => new MongoClient(configuration["MongoDbConnectionString"]));

Effectively this just means the object will be created when it is retrieved from the container the first time. This is because the Swashbuckle.Cli needs to be able to run Startup.ConfigureServices, and in the scenario where the docker container may not have the configuration available (because the entrypoint isn't necessarily getting called if the container is being run.

sciku1 avatar Apr 07 '22 07:04 sciku1

Is this still WIP? A-OK if so, just wondering if that's deliberate or not.

karashiiro avatar Apr 10 '22 19:04 karashiiro

Hey sorry, it's working locally but it seems like the CI fails when downloading the image and I hadn't had time to debug it. WIll get to it this weekend.

sciku1 avatar Apr 23 '22 05:04 sciku1