0

I am having my api documetation in swagger. I would like to provide my users with Client sdk dropdown with options of php and java. below is my code.

public void ConfigureServices(IServiceCollection services)
        {
           services.AddMvc();

            services.AddSingleton(provider => Configuration);
            services.AddTransient<IRegistrationRepository, ServiceUtilities>();
            services.AddTransient<IClientServiceConnector, ClientServiceValidation>();
            services.AddTransient<IEmailSender, EmailSender>();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
                {
                    Title = "Onboarding API",
                    Version = "V1",
                    Description = "API to generate lead and return the url",
                    TermsOfService = "Please see terms and conditions",
                    Contact = new Swashbuckle.AspNetCore.Swagger.Contact {Name = "teggggrap",Email = "support@dd.com.au",Url= "https://www.dd.com.au/" }
                });

                var basePath = PlatformServices.Default.Application.ApplicationBasePath;
                var xmlPath = Path.Combine(basePath, "gf.RegistrationApplication.xml");
                c.IncludeXmlComments(xmlPath);
            });

            services.AddCors(options =>
            {
                options.AddPolicy("AllowAll", policy =>
                {
                    policy.AllowAnyOrigin();
                    policy.AllowAnyHeader();
                    policy.AllowAnyMethod();
                });
            });
        }
maxspan
  • 13,326
  • 15
  • 75
  • 104
  • Your question is ambiguous. Is it that in Swagger generated metadata, you want your users to select one of these options (php, java) before they can execute a particular function (get, post, delete etc.)? – Geek Sep 18 '17 at 23:54
  • I want to generate Client SDK which can consume my API. IF a user is a php developer he can download my PHP sdk and use it. – maxspan Sep 19 '17 at 00:56

2 Answers2

1

The consumers of your API can generate swagger-codegen to create clients for your API in their language of choice. You probably don't want to host this yourself, but you could give your users instructions to go to https://editor.swagger.io/ where they can upload your API spec and generate it from there.

Manny
  • 11
  • 1
0

I've generate my php and JS SDKs with Codegen. It's pretty easy to use and then you can push the folder to a public Github repo and from your Swagger UI, you can tell your consumers to visit and follow the Getting started section !

It generates README.md and docs for each model.

Here is my sdk

lucyjosef
  • 712
  • 1
  • 8
  • 24