next-rest-framework
Advanced tools
Changelog
3.4.1 - 2023-10-24
Changelog
3.4.0 - 2023-10-24
Changelog
3.3.0 - 2023-10-23
Changelog
3.2.0 - 2023-10-23
Changelog
3.1.1 - 2023-10-19
Changelog
3.1.0 - 2023-10-19
next-rest-framework validate
CLI command, that checks that the generated openapi.json
file is up to date.Changelog
3.0.1 - 2023-10-18
title
and description
values with the docs config values when rendering the docs.Changelog
3.0.0 - 2023-10-18
This is another breaking change before another major release. This mostly changes the API on creating new endpoints. The old object-based definition of API endpoints is replaced by a functional model, familiar from e.g. the trpc library.
The docs route handlers and route handler functions
are renamed, followed up with new utility function
used in conjunction with the new routeHandler
and
apiRouteHandler
functions. The new additional
routeOperation
(app router) and apiRouteOperation
(pages router) functions expose the same old API
including the input, output and handler definitions
in a slightly new format by chaining the oprations
after each other.
We also recently dropped SwaggerUI that was replaced by Redoc. This change allows the user to defined their desired docs frontend, bringing back the option to use SwaggerUI or even both Redoc and SwaggerUI at the same time.
This fixes the query parameter typings that were incorrect for both routers so that they are safer to use.
This also fixes duplicate inclusion of the parameters in the OpenAPI spec when using dynamic routes.
There are also some typings improvements for response
status codes, that we're not working previously.
Unfortunately, for app router the status codes are
still not limited to the user-defined response statuses,
because the NextResponse
API makes this impossible.
Changelog
2.0.1 - 2023-10-15
This fixes a bug that caused an infinite request loop when using pages router and the docs endpoint was not ignored by the OpenAPI path generation.
This fix also allows defining multiple different docs endpoints, although that should be a rare case. The request protocol parsing is also now handled differently with pages router and cases where the protocol headers contain multiple protocols should be handled now.
Changelog
2.0.0 - 2023-10-15
Improve DX, API docs, router compability etc.
This is another breaking change to multiple components of the framework, changing the client API, simplifying route definition etc.
Re-designed client API
Previously all features of the framework were available via single client, initialized by the user in their code base. This change removes the concept of initializing a client and accessing route definitions etc. via the client.
The documentation part is now decoupled from defining individual routes, meaning that the new simplified workflow allows the developer to define a single route for the generated documentation if they want it.
Individual routes can still be defined like before, without importing the route definitions from the client.
The documentation endpoint also does not have to be a catch-all route and it can be defined anywhere in the code base without breaking things.
In addition to having less boilerplate with the new
client API, we also get rid of configuring the paths
for the app
and pages
directories. The new smarter
approach handles this automatically by scanning these
folders automatically, detecting the src
directory
is in use.
Streamlined OpenAPI spec generation
Previously, we were storing the generated openapi.json
file in the root of the project and serving that via another
internal endpoint. The new approach simply generates the spec
file directly to the public
folder, where it will be served
for the API documentation.
Replacing SwaggerUI with Redoc
Redoc is a great open source project and replacement for SwaggerUI, offering more features like richer endpoint previews, search etc. The new rendered API documentation uses Redocly and it can still be configured and customized by the developer.