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

WebApiToSwaggerGenerator: Mapping types #849

Closed
johlandabee opened this issue Jul 18, 2017 · 2 comments
Closed

WebApiToSwaggerGenerator: Mapping types #849

johlandabee opened this issue Jul 18, 2017 · 2 comments

Comments

@johlandabee
Copy link

I am using Swashbuckle and remap two types like this:

services.AddSwaggerGen(c =>
{
    c.SwaggerDoc(Swagger.Version, new Info
    {
        Title = Swagger.Title,
        Version = Swagger.Version,
        Description = Swagger.Description,
        Contact = new Contact
        {
            Name = Swagger.Name,
            Email = Swagger.Email
        }
    });

    c.MapType<Base64DataUrl>(() => new Schema { Type = "string" });
    c.MapType<ColorRgb>(() => new Schema { Type = "string" });
});

Is there a possibility to archive the same using the NSwag CLI?

@RicoSuter
Copy link
Owner

There are TypeMappers but they only work when used with the middleware... The cli uses appdomains and it is (currently) not possible to do this... You need to write your own simple cmd line tool.

@johlandabee
Copy link
Author

Alright, I will write a little tool for that. Thanks.

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

No branches or pull requests

2 participants