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

Inconsistent Naming Conventions in code and API.yml #8

Open
andylizf opened this issue Jan 21, 2024 · 3 comments
Open

Inconsistent Naming Conventions in code and API.yml #8

andylizf opened this issue Jan 21, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@andylizf
Copy link
Contributor

There is an inconsistency in the naming conventions used within our codebase and the API.yml file. Specifically, some variable and attribute names are using snake_case, while others are using camelCase. This inconsistency might lead to confusion, reduce code readability, and potentially cause errors in future development.

For example, in page-respond.dto.ts,

export class PageRespondDto {
  @IsNumber()
  page_start: number;

  @IsNumber()
  page_size: number;

  @IsNumber()
  has_prev: boolean;

  @IsNumber()
  prev_start: number;

  @IsNumber()
  has_more: boolean;

  @IsNumber()
  next_start: number;
}

and camelStyle is used elsewhere.

In addition, this mismatch also occurs between API.yml and the codebase.

@Nictheboy
Copy link
Contributor

Using snake_case in DTO classes is due to the fact that the field names in a DTO class is the field names in the JSON response.

If we want to change naming conventions in DTO classes, then API.yml and front-end code should be changed, too, together with all the test cases.

I think this is not a high priority issue.

@Nictheboy
Copy link
Contributor

From API.yml:

    Page:
      type: object
      description: 分页信息
      properties:
        page_start:
          type: integer
          format: int64
          description: 该页第一个 item 的 ID
        page_size:
          type: integer
          format: int64
          description: 每页 item 数量
        has_prev:
          type: boolean
          description: 是否有上一页
        prev_start:
          type: integer
          format: int64
          description: 上一页第一个 item 的 ID
        has_more:
          type: boolean
          description: 是否有下一页
        next_start:
          type: integer
          format: int64
          description: 下一页第一个 item 的 ID

@Nictheboy Nictheboy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2024
@andylizf andylizf reopened this Feb 29, 2024
@andylizf
Copy link
Contributor Author

And now the singular and plural problem of the code library is also worrying...

@andylizf andylizf added the enhancement New feature or request label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants