Controller

@Tag(name = "유저", description = "유저 관련 API입니다.")
@RestController
public class TestController {

	@Operation(summary = "유저 다건 조회", description = "유저 단건 조회 API입니다.")
	@GetMapping("/users")
	public ResponseEntity<TestResponse> get() {
		return ResponseEntity.ok(new TestResponse("test"));
	}

	@Operation(summary = "유저 가입", description = "유저 가입 API입니다.")
	@PostMapping("/users")
	public ResponseEntity<TestResponse> post(
		@RequestBody  TestRequest testRequest
	) {
		TestResponse response = new TestResponse("1");
		URI location = ServletUriComponentsBuilder.fromCurrentRequest()
			.path("{id}")
			.buildAndExpand(response.getName())
			.toUri();
		return ResponseEntity.created(location)
			.body(response);
	}
}

DTO

public class TestRequest {

	@Schema(description = "이름", defaultValue = "testName")
	private String name;

}

public class TestResponse {

	@Schema(description = "반환 이름", defaultValue = "testName")
	private String name;

}

참고

Swaager에 대해