TongchengOpenSource / smart-doc

Smart-doc is a java restful api document generation tool. Smart-doc is based on interface source code analysis to generate interface documentation, completely zero-injection.
https://smart-doc-group.github.io/#/
Apache License 2.0
1.42k stars 278 forks source link

Do you have a plan to support multiple request example and mutiple response example #932

Open jay763190097 opened 1 week ago

jay763190097 commented 1 week ago

Is your feature request related to a problem? Please describe.(关于这个PR的描述,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

Do you have a plan to support multiple request example and mutiple response example

Basic example (PR的用例,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

can support multiple request example and multiple response example

Describe the solution you'd like (描述您想要的解决方案,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

can support multiple request example and multiple response example

Describe alternatives you've considered (描述你考虑过的替代方案,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

No response

Additional context (其他背景信息,社区已开启国际化推广,请文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)

No response

Validations

linwumingshi commented 1 week ago

Hi @jay763190097

Thanks for your issues ! Could you please provide more details on the use case for supporting multiple request and response examples? Understanding your specific scenario will help us better evaluate and implement this feature.

jay763190097 commented 5 days ago

@linwumingshi , Actually, It's the same meaning with example in Open API. In Open API, we have request example and response example these two concept, it's helpful for testing different scenarios in debug mode.

shalousun commented 5 days ago

@linwumingshi , Actually, It's the same meaning with example in Open API. In Open API, we have request example and response example these two concept, it's helpful for testing different scenarios in debug mode.

Currently, smart-doc only supports auto-generating random values or using mock data. If multiple test cases are involved, the data source for these test cases might be more complex to write. You can propose some of your implementation solutions.

jay763190097 commented 4 days ago

@linwumingshi Understand. In my opinion, we can add a tag @Example name type(body, header, request parameter, path parameter) value, if it's a json body, value can like this file(classpath:test_scenario1_success.json). But this one, I recommender that we only display examples on the debug page, and can choose different example name to test it.