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

fetcher input type bug in Post api without body #270

Closed
rojiwon123 opened this issue Mar 7, 2023 · 1 comment
Closed

fetcher input type bug in Post api without body #270

rojiwon123 opened this issue Mar 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rojiwon123
Copy link
Contributor

현재 1.0.1 기준으로 @Body나 @TypedBody를 사용하지 않고 POST sdk를 만들면
Input type은 안생기는데, stringify는 Input타입을 사용하고 있는 버그가 발생했습니다.

at v1.0.1, If i don't use Body in POST api. sdk generated like that.
Input type is undefined, but stringify use the type.

export namespace signInGithub
{
    export type Output = IAuthUsecase.SignInResponse;

    export const METHOD = "POST" as const;
    export const PATH: string = "/sign-in/github";
    export const ENCRYPTED: Fetcher.IEncrypted = {
        request: false,
        response: false,
    };

    export function path(): string
    {
        return `/sign-in/github`;
    }
    export const stringify = (input: Input) => typia.assertStringify(input); // Inpu is undefined type.
}

제가 생각한 수정 방향입니다!

개발자가 body를 사용하지 않는 POST API를 설계했을 때,

  1. sdk는 알아서 Input Type을 undefined, unknown, {} 등으로 정의한다.
    • Input Type이 정의되므로 현재 발생된 문제 해결)
  2. Input Type을 생성하지 않은 것 처럼, stringify도 생성하지 않는다.

When a developer designs a POST API without using a body,

  1. the SDK automatically defines the Input Type as undefined, unknown, {}.
    • As the Input Type is defined, any issues that may arise from this can be resolved.
  2. Similarly, since the Input Type is not created, the SDK does not generate a stringify method.

Originally posted by @industriously in #266 (comment)

@rojiwon123 rojiwon123 changed the title 현재 @nestia/fetcher 1.0.1 기준으로 @Body나 @TypedBody를 사용하지 않고 POST sdk를 만들면 fetcher input type bug in Post api without body Mar 7, 2023
@samchon
Copy link
Owner

samchon commented Mar 7, 2023

Will fix by second way. Thanks for report

@samchon samchon self-assigned this Mar 7, 2023
@samchon samchon added the bug Something isn't working label Mar 7, 2023
@samchon samchon closed this as completed in 8939c29 Mar 7, 2023
samchon added a commit that referenced this issue Mar 7, 2023
Fix #270 - when no body on POST method
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