Skip to content

Implement OpenApi spec with custom generator#56

Merged
olix3001 merged 5 commits intomainfrom
50-swagger
Feb 26, 2026
Merged

Implement OpenApi spec with custom generator#56
olix3001 merged 5 commits intomainfrom
50-swagger

Conversation

@olix3001
Copy link
Contributor

This PR implement custom generator for OpenApi spec and replaces simple jsdoc commands with generator decorators.
This is a simple custom system that automatically detects all existing routes and generates endpoints in openapi json format.
There is a builtin schema explorer at /spec available.

Endpoints accept the following decorators:
@ApiTag(string) - Sets endpoint to use provided tag (group)
@ApiOpration({ ... }) - Describes the operation itself
@ApiRequest({ ... }) - Automatically generates request body spec from validator
@ApiResponse(number, { ... }) - Generates possible api response. It accepts a custom data format of either a Lucid model, Vine validator, object with string keys, custom utilities like paginated(...), merged(...), alternative(...

Current implementation detects auth automatically, but it would be possible to introduce a special decorator for that if necessary in the future.

There is also @ApiColumn decorator which MUST be used on all model fields that should be reported in spec.
If this decorator is missing the column will be omitted.

Closes #50

@olix3001 olix3001 linked an issue Feb 26, 2026 that may be closed by this pull request
@olix3001 olix3001 assigned olix3001 and unassigned olix3001 Feb 26, 2026
Copy link
Member

@InfoX1337 InfoX1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way too big of a PR to review, but at a glance lgtm.

@olix3001 olix3001 merged commit 859edfb into main Feb 26, 2026
4 of 5 checks passed
@olix3001 olix3001 deleted the 50-swagger branch February 26, 2026 18:01
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

Successfully merging this pull request may close these issues.

OpenAPI/Swagger reference for the REST api

2 participants