Steps to reproduce
- Create an OpenAPI spec with snake_case API path definitions:
paths:
/api/v1/app/user_point_balance:
get:
summary: Get user point balance
- Generate Dart code using dart run swagger_parser
- Check the generated
@GET annotation in the Retrofit client
Expected results
The generated Retrofit annotation should preserve the original case from the OpenAPI path definition:
@GET('/api/v1/app/user_point_balance')
Actual results
The API path is incorrectly converted to PascalCase:
@GET('/api/v1/app/UserPointBalance')
This results in incorrect API endpoints that don't match the backend server routes.
Your OpenApi snippet
openapi: 3.0.0
paths:
/api/v1/app/user_point_balance:
get:
summary: Get user point balance
operationId: getUserPointBalance
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/UserPointBalance'
components:
schemas:
UserPointBalance:
type: object
properties:
balance:
type: integer
Code sample
@RestApi()
abstract class PointsClient {
factory PointsClient(Dio dio, {String? baseUrl}) = _PointsClient;
@GET('/api/v1/app/UserPointBalance') // ❌ Wrong! Path converted to PascalCase
Future<UserPointBalance> getUserPointBalance();
}
@RestApi()
abstract class PointsClient {
factory PointsClient(Dio dio, {String? baseUrl}) = _PointsClient;
@GET('/api/v1/app/user_point_balance') // ✅ Correct! Path preserved as snake_case
Future<UserPointBalance> getUserPointBalance();
}
Logs
Logs
Dart version and used packages versions
Dart SDK version: 3.10.0 (stable)
dependencies:
retrofit: ^4.9.1
dev_dependencies:
swagger_parser: ^1.41.0
Steps to reproduce
@GETannotation in the Retrofit clientExpected results
The generated Retrofit annotation should preserve the original case from the OpenAPI path definition:
@GET('/api/v1/app/user_point_balance')Actual results
The API path is incorrectly converted to PascalCase:
@GET('/api/v1/app/UserPointBalance')This results in incorrect API endpoints that don't match the backend server routes.
Your OpenApi snippet
Code sample
Logs
Logs
[Paste your logs here]Dart version and used packages versions
Dart SDK version: 3.10.0 (stable)
dependencies:
retrofit: ^4.9.1
dev_dependencies:
swagger_parser: ^1.41.0