ChazaAPI Version 2.0.0 — Major Release
Overview
Version 2.0.0 is currently in development and aims to:
- Fix critical bugs introduced in 1.0.2
- Implement long-awaited features
- Improve overall developer experience and API documentation quality
Originally planned as version 1.1.0, the extent of these changes warranted a major version bump to 2.0.0.
Fixes
Proper Fallback to @Chaza Defaults
- Fields in
@EndPointsuch ascontentType,accept, androleswill no longer use predefined values that previously blocked fallback behavior. - ChazaAPI will correctly detect when a field is unset and apply the corresponding value from the class-level
@Chazaannotation. - This enables true default inheritance, eliminating the need to repeat common metadata in every endpoint.
New Feature: DTO Support
Version 2.0.0 introduces support for requestDTO and responseDTO, allowing you to specify data transfer objects for request and response payloads:
@EndPoint(
method = Method.POST,
url = "/users",
requestDTO = CreateUserRequest.class,
responseDTO = UserResponse.class
)
How ChazaAPI Will Process API Annotations
ChazaAPI will combine metadata from class-level @Chaza and method-level @EndPoint annotations to generate comprehensive API documentation. This merging will allow you to define global defaults and override them per endpoint with ease.
Annotation Merging and Defaults
Group
If the @EndPoint annotation’s group is empty, ChazaAPI will use the group from the class-level @Chaza.
HTTP Method and URL
- The HTTP method will be taken from
@EndPoint. - The full URL path will be constructed by combining the
@ChazabaseUrlwith the@EndPointURL, automatically handling slashes.
Content Types
accept (what client sends) and contentType (what server responds with) will default to class-level @Chaza values unless overridden in @EndPoint.
Roles and Security
Roles specified in @EndPoint will override class-level roles. If no roles are specified on the endpoint, the class-level roles will apply.
Request and Response Metadata
ChazaAPI will support two ways to define request and response bodies:
-
Field-Level Metadata
You will userequestFieldsandresponseFieldsin@EndPointto specify individual fields and types. -
DTO Classes
You will specifyrequestDTOandresponseDTOclasses to automatically extract fields via reflection.
Note: You will have to choose either fields or DTOs for request and response — not both at the same time. ChazaAPI will validate this and throw errors if both are set.
Summary
This system will enable you to:
- Define global defaults once at the controller level with
@Chaza. - Override specific endpoint metadata only when needed with
@EndPoint. - Use either detailed field annotations or DTO classes for payload documentation.
- Include security roles, headers, and status codes seamlessly in generated docs.
By automating the merging and validation of these annotations, ChazaAPI will produce accurate, up-to-date, and easy-to-maintain API documentation.
ScanEndPoints — Smarter, More Flexible API Scanning (Coming in v2.0.0)
In ChazaAPI 2.0.0, we will introduce a new and improved method called scanEndPoints() that will simplify how you discover and extract metadata from your annotated API classes.
This method will be replace scanEndpoints() as this will follow Java Naming Convention.
This method will support both automatic scanning by package and manual class input — providing flexibility while improving ease of use.
Usage Options
Option 1: Auto-Scan Using Package Name
The recommended approach will be to scan a package that contains all your controllers annotated with @Chaza.
List<Endpoint> endpoints = ChazaScanner.scanEndPoints("com.example.api");
ChazaAPI will:
- Automatically find all classes annotated with
@Chaza - Extract method-level
@EndPointannotations - Merge class- and method-level metadata
- Apply fallback values from
@Chazawhen fields are missing in@EndPoint
Option 2: Manually Provide Controller Classes
If you want full control (for example, in testing), you will still be able to pass a list of specific controller classes.
List<Class<?>> controllers = List.of(UserController.class, AdminController.class);
List<Endpoint> endpoints = ChazaScanner.scanEndPoints(controllers);
This method will remain fully supported and will benefit from improved annotation merging.
How It Will Work
- The method name
scanEndPointswill align better with Java naming conventions.- When using package scanning, ChazaAPI will use reflection to detect:
- All classes with the
@Chazaannotation- All methods with the
@EndPointannotation- It will merge metadata intelligently:
group,roles,accept,contentType, etc., will fallback to class-level@Chazaif not set in@EndPoint.- URL paths will be combined from
@Chaza.baseUrl+@EndPoint.url.
UI
The user interface will be enhanced to provide clear and organized information about each API group defined via the @Chaza and @EndPoint annotations.
Endpoint Groups
- The UI will display a description for each API group.
- This will help developers and API consumers easily navigate and understand different sections of the API (e.g.,
admin,user,public, etc.). - Group descriptions will be derived from metadata defined in the annotations, when available.
Remaining Fields
- Any currently unrendered metadata fields — such as
accept(what the client is expected to send) — will be added to the UI. - These fields will appear alongside others like
contentType,headers,roles, andstatusCodes.
This UI update will ensure a more complete, structured, and user-friendly API documentation experience.
Remaining Fields
- Any currently unrendered metadata fields — such as
accept(what the client is expected to send) — will be added to the UI. - These fields will appear alongside others like
contentType,headers,roles, andstatusCodes.
By improving the UI to surface all relevant metadata, ChazaAPI will offer a more complete and user-friendly API documentation experience.