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

Custom extension of DocJavaMethod. #488

Closed
younker99 opened this issue Apr 22, 2023 · 3 comments
Closed

Custom extension of DocJavaMethod. #488

younker99 opened this issue Apr 22, 2023 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@younker99
Copy link
Contributor

younker99 commented Apr 22, 2023

Summary(关于这个pr的描述)

Before converting List to List, invoke custom extensions for adjustments.
List<DocJavaMethod>转化为List<ApiMethodDoc>前,调用自定义的拓展进行调整。`

Basic example(pr的用例)

Preliminary design is as follows:

  1. Define ICusJavaMethodExtension with the content being List<DocJavaMethod> apply(JavaClass cls, List<DocJavaMethod> methodList).
  2. Add an ICusJavaMethodExtension cusJavaMethodExtension attribute to ApiConfig.
  3. In IRestDocTemplate, before converting List<DocJavaMethod> to List<ApiMethodDoc> within the buildEntryPointMethod, check and invoke cusJavaMethodExtension to update the List<DocJavaMethod>.

初步设计是

  1. 定义ICusJavaMethodExtension,内容为List<DocJavaMethod> apply(JavaClass cls, List<DocJavaMethod> methodList)
  2. ApiConfig中添加ICusJavaMethodExtension cusJavaMethodExtension属性
  3. 在IRestDocTemplate中buildEntryPointMethod里,List<DocJavaMethod>转化为List<ApiMethodDoc>前,判断并调用cusJavaMethodExtension,更新List<DocJavaMethod>

Motivation(提出这个pr目的)

The common controller encapsulated in the project features multiple levels of inheritance, with some methods having dynamic return types and parameters. The type information parsed by smart-doc for these interfaces is inaccurate and cannot be adjusted.

项目中封装的通用controller存在多层继承,部分method的返回值和入参是动态类型,此部分接口smart-doc解析出的类型信息不准确,却又无法调整。

@younker99 younker99 added the enhancement New feature or request label Apr 22, 2023
@shalousun
Copy link
Collaborator

shalousun commented Apr 22, 2023

@younker99 You can supplement the examples in the test project at https://github.com/smart-doc-group/smart-doc-example-cn first. Wouldn't it be better to rename ICusJavaMethodExtension to ICustomJavaMethodHandler, as smart-doc does not advocate for using non-generic terms that are too specific? Start by adding examples and then submit a PR.

@younker99
Copy link
Contributor Author

younker99 commented Apr 23, 2023

@shalousun
smart-doc-group/smart-doc-example-cn#20
Controller sample has been supplemented.

@shalousun
Copy link
Collaborator

shalousun commented Apr 23, 2023

@shalousun smart-doc-group/smart-doc-example-cn#20 Controller sample has been supplemented.

merged

younker99 added a commit to younker99/smart-doc that referenced this issue Apr 23, 2023
shalousun added a commit that referenced this issue May 2, 2023
添加DocJavaMethod自定义拓展 #488
@shalousun shalousun added this to the 2.6.8 milestone May 2, 2023
@shalousun shalousun changed the title DocJavaMethod自定义拓展 Custom extension of DocJavaMethod. Jun 28, 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

2 participants