Base solution for your next web application
Open Closed

personalized nswag #12589


User avatar
0
gtc created

Version asp.net zero : 14.3 asp.net core net 9 angular version 19

Good morning, Do you know how to do with nswag/refresh.bat to generate only one API and not all of the swagger APIs?

I also received this message. ?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @gtc

    The error in your screenshot is caused by an incorrect path. To fix this, you simply need to run the refresh.bat file located specifically inside the angular/nswag folder.

    Regarding your request to generate "only one API," are you trying to update just one specific controller in your current project, or are you looking to generate a proxy for a completely external API? If you can clarify this, we can provide the exact configuration you need.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gtc created

    hi

    Yes, only one controller and update the proxy

    thank's

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @gtc

    In ASP.NET Zero, NSwag does not work on a per controller basis. The refresh.bat command generates proxies based on the Swagger document, not individual controllers.

    So when you run refresh.bat, NSwag reads the configured swagger.json file, and all controllers exposed in that Swagger document are regenerated together. It is not possible to target or update only a single controller out of the box.

    Even if you changed only one controller, the recommended approach is still to regenerate all proxies from the same Swagger endpoint.

    Generating a proxy for a single controller would only be possible by creating a separate Swagger document that includes only that controller, which is outside the standard ASP.NET Zero setup and generally not recommended.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)