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

Add OpenApiJsonWriter for Issue 387 #390

Merged
merged 6 commits into from
Jun 1, 2022
Merged

Conversation

VictorZeng
Copy link
Collaborator

What this PR does / why we need it?

Fix issue #387 .

Summary of your change

Add OpenApiJsonWriter for SpringDoc String type writer.

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@VictorZeng
Copy link
Collaborator Author

@wenshao 很奇怪呀 JSON.register为什么会作用于其他testcase

@VictorZeng
Copy link
Collaborator Author

@wenshao 另外发现个问题 JSON.toJSONString(...) 对于输入JSON字符串 在1.x 和 2.x 表现不一样 1.x 输出和原字符串一样 2.x 输出的又将json字符串转义了一层

Expected :{"abc":"cde中文"}
Actual   :"{\"abc\":\"cde中文\"}"

@wenshao
Copy link
Member

wenshao commented May 31, 2022

@wenshao 很奇怪呀 JSON.register为什么会作用于其他testcase

JSON.register是全局的。

JSON.register(springfox.documentation.spring.web.json.Json.class, OpenApiJsonWriter.INSTANCE);

你应该这样用

@VictorZeng
Copy link
Collaborator Author

@wenshao 很奇怪呀 JSON.register为什么会作用于其他testcase

JSON.register是全局的。

JSON.register(springfox.documentation.spring.web.json.Json.class, OpenApiJsonWriter.INSTANCE);

你应该这样用

温少 spring-doc的问题主要是 因为json字符串又被转义了一层 这个应该如何处理 see上一条评论

@wenshao wenshao merged commit 0dd18c0 into alibaba:main Jun 1, 2022
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

Successfully merging this pull request may close these issues.

2 participants