Skip to content
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

WIP: API Client Generation #572

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

sciku1
Copy link

@sciku1 sciku1 commented Apr 7, 2022

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 added 2 commits April 7, 2022 00:45
…etons to when they are used (rather than on application startup)
@karashiiro
Copy link
Member

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

@sciku1
Copy link
Author

sciku1 commented Apr 23, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants