Validation rules
The processor validates your code at compile time and reports errors for:
API specification errors
| Error | Cause |
|---|---|
| Must be an object or concrete class | API spec is an interface or abstract class |
| Must extend ApiSpec | Missing ApiSpec base class or not overriding baseUrl |
| Duplicate API name | Multiple API spec classes with same name in package |
Request class errors
| Error | Cause |
|---|---|
| Must end with 'Request' suffix | Class name doesn't end with Request |
| Must be a data class | Has properties but isn't a data class |
| Marker class must be an object | No properties but isn't an object declaration |
| Object cannot have properties | Object declaration has properties |
| Cannot be abstract, sealed, or inner | Request class is abstract, sealed, or inner |
| Multiple HTTP method annotations | More than one of @GET, @POST, etc. |
| Must specify a path | HTTP annotation has empty path |
| Must have @Returns annotation | Missing @Returns annotation |
Parameter errors
| Error | Cause |
|---|---|
| @Path must be annotated with @Transient | Path parameter missing @Transient |
| @Path must be String, Int, Long, Short, Float, Double, or Boolean | Invalid path parameter type |
| Path variable has no matching @Path parameter | URL has {var} but no matching property |
| @Query must be annotated with @Transient | Query parameter missing @Transient |
| @Query must be nullable | Non-nullable query parameter |
| @Query not allowed on POST/PUT/PATCH | Query params on body requests |
| @Header type not allowed | Header parameter type not in allowed set |
| @Header must be annotated with @Transient | Header parameter missing @Transient |
| @Header must be nullable | Non-nullable header parameter |
| Invalid HTTP header name | Header name violates RFC 7230 |
| Cannot have multiple parameter annotations | Property has more than one of @Path, @Query, @Header |
| Body parameters not allowed on GET/DELETE | Body params on non-body requests |
| Body parameter must be nullable or have default | Non-nullable body param without default |
Return type errors
| Error | Cause |
|---|---|
| Return type not @Serializable | Response type missing @Serializable |
| Return type could not be resolved | Invalid or missing type in @Returns |