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

Fields in request parameters annotated with @JsonSerialize(using = ToStringSerializer.class) should not be marked as strings. #833

Closed
linwumingshi opened this issue Jun 30, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@linwumingshi
Copy link
Collaborator

Your Environment

  • smart-doc version: 3.0.5
  • Plugin version: smart-doc-maven-plugin 3.0.5
  • Build tool version: Maven 3.9.8
  • JDK version: 17

Expected Behavior

Fields in request parameters annotated with @JsonSerialize(using = ToStringSerializer.class) should be marked as their original types.

Current Behavior

Fields in request parameters that are annotated with @JsonSerialize(using = ToStringSerializer.class) are incorrectly marked as strings.
bug from #714 #715

Possible Solution

The type conversion to string should only occur when processing response parameters.

Steps to Reproduce

@Data
public class SerializerTestModel {

    /**
     * Serialize string to long 
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
}
package com.power.doc.controller.json;

import com.power.common.model.CommonResult;
import com.power.doc.model.SerializerTestModel;
import org.springframework.web.bind.annotation.*;

/**
 * Jackson ToStringSerializer test
 *
 * @author yusun 2024/01/30
 */
@RestController
@RequestMapping("/serializer")
public class SerializerTestController {


    /**
     * testSerializer
     *
     * @param model model
     */
    @PostMapping
    public CommonResult<SerializerTestModel> testSerializer(@RequestBody SerializerTestModel model) {
        return CommonResult.ok().setResult(model);
    }
}

Context

@linwumingshi linwumingshi added the bug Something isn't working label Jun 30, 2024
@shalousun shalousun added this to the 3.0.6 milestone Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants