Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The URL parameters with underscores /v1/{student_id}/courses cannot be correctly converted to camel case. #7

Open
qwlong opened this issue Jul 6, 2024 · 0 comments

Comments

@qwlong
Copy link

qwlong commented Jul 6, 2024

The URL parameters with underscores are not being correctly converted to camel case in the generated code. This issue occurs when using the OpenAPI YAML file with the following configuration:

/v1/students/{student_id}/courses/reading:
  get:
    operationId: getV1StudentsStudentIdCourses
    parameters:
    - name: student_id
      in: path
      required: true
      schema:
        type: string

Generated Code Example
The generated code does not properly convert the student_id parameter to camel case (studentId):

Future<Response<ApiV1EntitiesBasicCourse>>
    getV1StudentsStudentIdCourses(
        {required String studentId}) async {
  final queryParams = <String, dynamic>{};
  final uri = baseUri.replace(
      queryParameters: queryParams,
      path: baseUri.path +
          '/v1/students/${student_id}/courses');
  final response = await dio.getUri<Map<String, dynamic>>(uri);
  final parsed = ApiLearningV1EntitiesBasicCourse.fromJson(response.data!);
  return Response<ApiLearningV1EntitiesBasicCourse>(
    data: parsed,
    headers: response.headers,
    requestOptions: response.requestOptions,
    isRedirect: response.isRedirect,
    statusCode: response.statusCode,
    redirects: response.redirects,
    extra: response.extra,
  );
}

Expected Behavior
The parameter student_id should be correctly converted to camel case (studentId) in the generated code, ensuring consistency and correct functionality.

@qwlong qwlong changed the title The URL parameters with underscores cannot be correctly converted to camel case. The URL parameters with underscores /v1/{student_id}/courses cannot be correctly converted to camel case. Jul 6, 2024
qwlong added a commit to qwlong/openapi_freezed_dio_builder that referenced this issue Jul 6, 2024
…d to camel case. jonasbark#7

jonasbark#7

The URL parameters with underscores are not being correctly converted to camel case in the generated code. This issue occurs when using the OpenAPI YAML file with the following configuration:

/v1/students/{student_id}/courses/reading:
  get:
    operationId: getV1StudentsStudentIdCourses
    parameters:
    - name: student_id
      in: path
      required: true
      schema:
        type: string
Generated Code Example
The generated code does not properly convert the student_id parameter to camel case (studentId):

Future<Response<ApiV1EntitiesBasicCourse>>
    getV1StudentsStudentIdCourses(
        {required String studentId}) async {
  final queryParams = <String, dynamic>{};
  final uri = baseUri.replace(
      queryParameters: queryParams,
      path: baseUri.path +
          '/v1/students/${student_id}/courses');
  final response = await dio.getUri<Map<String, dynamic>>(uri);
  final parsed = ApiLearningV1EntitiesBasicCourse.fromJson(response.data!);
  return Response<ApiLearningV1EntitiesBasicCourse>(
    data: parsed,
    headers: response.headers,
    requestOptions: response.requestOptions,
    isRedirect: response.isRedirect,
    statusCode: response.statusCode,
    redirects: response.redirects,
    extra: response.extra,
  );
}
Expected Behavior
The parameter student_id should be correctly converted to camel case (studentId) in the generated code, ensuring consistency and correct functionality.
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

No branches or pull requests

1 participant