Duplicate generated model classes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- java
调研方向
首先跟踪报告中显示的生成的 RolesClient 方法以及 Role、GetRoleResponseContent 和 CreateRoleResponseContent 模型。比较它们的 schema 和必填字段,然后验证等效操作是否复用同一种模型类型,以及必需的 API 字段是否不再表示为 Optional。
由索引模型根据 Issue 内容生成。
描述
Checklist
- I have looked into the Readme and Examples, and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
RolesClient {
public SyncPagingIterable<Role> list(ListRolesRequestParameters request) {
return this.rawClient.list(request).body();
}
public GetRoleResponseContent get(String id) {
return this.rawClient.get(id).body();
}
public CreateRoleResponseContent create(CreateRoleRequestContent request) {
return this.rawClient.create(request).body();
}
}
Duplicate generated model classes.
The generated SDK appears to create separate model classes for list, get and create operations, even when they represent the same resource and contain identical properties.
For example, a list() operation may return a Role model, while the corresponding get() operation returns a GetRoleResponseContent model, despite both models appearing to be structurally identical.
Using different model classes for the same resource makes the SDK inconsistent and adds unnecessary complexity for consumers. It would be preferable to reuse the same model type across operations whenever the underlying schemas are equivalent.
public final class Role {
private final Optional<String> id;
private final Optional<String> name;
private final Optional<String> description;
private final Map<String, Object> additionalProperties;
}
public final class GetRoleResponseContent{
private final Optional<String> id;
private final Optional<String> name;
private final Optional<String> description;
private final Map<String, Object> additionalProperties;
}
public final class CreateRoleResponseContent {
private final Optional<String> id;
private final Optional<String> name;
private final Optional<String> description;
private final Map<String, Object> additionalProperties;
}
Fields such as id and name are required by the API, yet they are generated as Optional. This is misleading and results in unnecessary code such as role.getId().get(), while IDEs still warn that the value may be absent.
Reproduction
Additional context
No response
auth0-java version
3.10.0
Java version
21.0.1
- 主要语言
- Java
- 星标
- 319
- 派生
- 155
- 平均合并
- 4 小时 49 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
auth0/auth0-java 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
auth0/auth0-java#887 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
auth0/auth0-java#842 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 25/100
auth0/auth0-java#897 ·
维护者通常 1 天内回复
-
Make DefaultHttpClient extensible可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭feature request
难度 1/5 1 小时以内 新手友好度 50/100
auth0/auth0-java#754 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
objectionary/hone-maven-plugin#1295 ·
维护者通常 1 天内回复
-
Clarify Javadoc for Logger methods taking Object... arguments with regards to Throwable detection未关闭
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1-3 小时 新手友好度 88/100
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
[Bug] The shared instance selector's placeholder and no-match text ignore the display language可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 90/100
apache/rocketmq-dashboard#5561 ·
维护者通常 3 天内回复