Skip to content

Releases: blomqma/next-rest-framework

v3.1.0

19 Oct 17:37
Compare
Choose a tag to compare
v3.1.0 Pre-release
Pre-release

Added

  • Add new next-rest-framework validate CLI command, that checks that the generated openapi.json file is up to date.

Changed

  • Improves the CLI performance, making it supported in any runtime.

v3.0.1

18 Oct 17:26
Compare
Choose a tag to compare
v3.0.1 Pre-release
Pre-release

Changed

  • Override the OpenAPI info title and description values with the docs config values when rendering the docs.

v3.0.0

18 Oct 17:26
Compare
Choose a tag to compare
v3.0.0 Pre-release
Pre-release

Changed

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.

Fixed

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.

v2.0.1

15 Oct 15:02
Compare
Choose a tag to compare
v2.0.1 Pre-release
Pre-release

Fixed

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.

v2.0.0

15 Oct 11:18
Compare
Choose a tag to compare
v2.0.0 Pre-release
Pre-release

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.

v1.2.4

09 Oct 20:12
Compare
Choose a tag to compare
v1.2.4 Pre-release
Pre-release

Fixed

  • Fix query parameter validation on app router - now the search parameters are validated similarly to when using Pages Router.
  • Fix content type validation when no user-defined content type validation is set.

Thanks @mirko314 for the query parameter fix.

v1.2.3

07 Oct 10:14
Compare
Choose a tag to compare
v1.2.3 Pre-release
Pre-release

Fixed

  • Fix appDirPath handling when not using src directory.

v1.2.2

01 Oct 08:40
Compare
Choose a tag to compare
v1.2.2 Pre-release
Pre-release

Fixed

  • Fix miscellaneous issues with generating the OpenAPI spec from Zod schema, by using zod-to-json-schema.

v1.2.1

30 Sep 08:08
Compare
Choose a tag to compare
v1.2.1 Pre-release
Pre-release

Fixed

  • Fix request body validation with App Router. The new validation clones the request object before validating it, allowing the request body to be further parsed by the API handler.

v1.2.0

27 Sep 00:24
Compare
Choose a tag to compare
v1.2.0 Pre-release
Pre-release

Added

  • Add option to allow/deny paths from Next REST Framework. This ensures better compability with other third-party server-side libraries and routes not using Next REST Framework.
  • Add logging for error cases when the app/pages directory is not found based on the config options.
  • Add logging for ignored paths based on the allow/deny lists.