Universalis
Universalis copied to clipboard
WIP: API Client Generation
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.
Is this still WIP? A-OK if so, just wondering if that's deliberate or not.
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.