what does Swagger server stub mean?

From a swagger tutorial:

With SwaggerHub, you can easily generate a server stub (an API implementation stub) for Node.js, ASP.NET, JAX-RS, and other servers and frameworks. The server stub is a good starting point for implementing your API – you can run and test it locally, implement the business logic for your API, and then deploy it to your server.

https://app.swaggerhub.com/help/apis/generating-code/server-stub

and a stub is:

method stub or simply stub in software development is a piece of code used to stand in for some other programming functionality. A stub may simulate the behavior of existing code (such as a procedure on a remote machine, such methods are often called mocks) or be a temporary substitute for yet-to-be-developed code. Stubs are therefore most useful in porting, distributed computing as well as general software development and testing.

https://en.wikipedia.org/wiki/Method_stub


Stub the API means : create à mock to serve examples described in swagger file. This mock can be formatted in specific languages/ framework


Server stubbing can be quite powerful depending on the backend platform and framework you plan to use for your API.

For example, you may choose Apache (common in Linux environments) or ASP.NET (common for IIS). The server "stubs" being generated will typically be a deployable library to that specific platform. What you typically get is:

  • Routing to your business logic. The framework will handle the HTTP specification, but actually mapping from a "controller" to your service layer is being handled by the code generator, based on your API specification.
  • Serialization and Deserialization of your models (applies to strongly-typed languages like Java/C#).
  • AuthN/AuthZ may be handled, to some degree, based on the framework's support for your API's chosen auth scheme.

tl;dr: A server stub is intended to be a ready-to-deploy application that routes HTTP requests to your actual business logic on the backend.