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

Close #815 - new module http - query, headeres and parameter #819

Merged
merged 10 commits into from
Sep 26, 2023

Conversation

samchon
Copy link
Owner

@samchon samchon commented Sep 26, 2023

New module http has been newly added.

export namespace http {
    export function parameter<T extends boolean | bigint | number | string>(input: string): T;

    export function headers<T extends object>(input: Record<string, string | string[] | undefined>): Resolved<T>;
    export function isHeaders<T extends object>(input: Record<string, string | string[] | undefined>): Resolved<T> | null;
    export function assertHeaders<T extends object>(input: Record<string, string | string[] | undefined>): Resolved<T>;
    export function validateHeaders<T extends object>(input: Record<string, string | string[] | undefined>): IValidation<Resolved<T>>;

    export function query<T extends object>(input: URLSearchParams): Resolved<T>;
    export function isQuery<T extends object>(input: URLSearchParams): Resolved<T> | null;
    export function assertQuery<T extends object>(input: URLSearchParams): Resolved<T>;
    export function validateQuery<T extends object>(input: URLSearchParams): IValidation<Resolved<T>>;
}

For reference, those features had been developed in @nestia/core for a long time.

The reason why migrating them from @nestia/core is to support Fastify plugin like nestia case.

samchon and others added 8 commits September 22, 2023 21:20
When special characters being used in swagger component name, `typia` had changed it to another special character like `_comma_`. However, it seems not a good solution. I've changed it to be just empty string.
Change naming strategy of swagger components.
Test programs and transformers are not yet.

  - HttpHeadersProgrammer
  - HttpParametersProgrammer
  - HttpQueryProgrammer
Completed to implement http module programs. By the way, it means only the main program, and test programs are not prepared yet.
Passed every test programs and error cases.
As HTTP headers do not distinguish whether each letter is lowercase or uppercase, `typia.http.headers<T>()` function needs to inpsect that target type `T` has duplicated key when converting to lowercase characters.
@samchon samchon added the enhancement New feature or request label Sep 26, 2023
@samchon samchon self-assigned this Sep 26, 2023
@samchon samchon changed the title New module http - query, headeres and parameter Close #815 - new module http - query, headeres and parameter Sep 26, 2023
@samchon
Copy link
Owner Author

samchon commented Sep 26, 2023

Close #815

Did a mistake on some file name: `*.ts copy`.
Copy link
Owner Author

@samchon samchon left a comment

Choose a reason for hiding this comment

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

Succeeded to pass every test programs.

@samchon samchon merged commit 04b7b39 into master Sep 26, 2023
@samchon samchon deleted the features/http branch September 26, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant