Skip to content

[#9] 선언형 요청 DSL 기본 구조를 구현한다#16

Merged
opficdev merged 5 commits into
developfrom
feat/#9-DSL
Apr 13, 2026
Merged

[#9] 선언형 요청 DSL 기본 구조를 구현한다#16
opficdev merged 5 commits into
developfrom
feat/#9-DSL

Conversation

@opficdev
Copy link
Copy Markdown
Owner

🔗 연관된 이슈

📝 작업 내용

📌 요약

  • 엔드포인트 프로토콜 구현
  • 요청 진입 클라이언트 구현
  • 요청 빌더 기본 체이닝 구현
  • DSL 기본 구조 테스트 구현

🔍 상세

  • 엔드포인트 프로토콜 구조 구현
    • NXEndpoint
    • 기본 configure extension
  • 요청 진입 클라이언트 구조 구현
    • NXAPIClient
    • get/post/put/patch/delete
    • request(_ endpoint:)
  • 요청 빌더 기본 체이닝 구조 구현
    • NXRequestBuilder
    • query, header, headers, accept, authorized, timeout
    • immutable 패턴(modifying) 기반으로 새 인스턴스 반환
  • 테스트 추가
    • NXDeclarativeRequestDSLTests
    • HTTP 메서드 진입점 설정 검증
    • Endpoint configure 적용 검증
    • Builder value semantics 검증
    • header/accept 누적 동작 검증

테스트

  • swift test 통과

📸 영상 / 이미지 (Optional)

image

@opficdev opficdev self-assigned this Apr 13, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 풀 리퀘스트는 선언형 네트워크 요청 DSL 구성을 위한 핵심 컴포넌트들을 추가합니다. NXRequestBuilder에 제네릭을 도입하여 응답 타입 정보를 유지하고, Dictionary.merge를 활용해 헤더 설정 로직을 개선할 것을 권장합니다.

Comment thread Nexa/Sources/Nexa/Public/NXRequestBuilder.swift
Comment thread Nexa/Sources/Nexa/Public/NXEndpoint.swift
Comment on lines +33 to +35
values.forEach { key, value in
requestSpec.headers[key] = value
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

forEach를 통한 개별 할당 대신 Dictionary.merge를 사용하면 코드가 더 간결해지고 의도가 명확해집니다.

            requestSpec.headers.merge(values) { _, new in new }
References
  1. RequestSpec should remain internal as a separate public DSL is planned for external use.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 풀 리퀘스트는 NXAPIClient, NXEndpoint, NXRequestBuilder를 도입하여 선언형 네트워크 요청을 위한 DSL 기초 구조를 구축했습니다. 리뷰를 통해 NXEndpoint의 Response 타입을 NXRequestBuilder에 반영하여 타입 안정성을 강화하는 설계 개선과, 헤더 설정 시 merge 메서드를 활용하여 코드를 더 간결하고 선언적으로 작성하는 방안이 제안되었습니다.

Comment thread Nexa/Sources/Nexa/Public/NXAPIClient.swift
Comment thread Nexa/Sources/Nexa/Public/NXRequestBuilder.swift
@opficdev opficdev merged commit 58434ec into develop Apr 13, 2026
4 checks passed
@opficdev opficdev deleted the feat/#9-DSL branch April 13, 2026 02:07
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.

선언형 요청 DSL 기본 구조를 구현한다

1 participant