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

Feat: buildVoid method #2245

Merged
merged 6 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
buildVoid - naming certified by ChatGPT.
  • Loading branch information
RobinTail committed Dec 9, 2024
commit adc221da2934941fc2bd3bcffc6fa81c83c3e6fa
2 changes: 1 addition & 1 deletion example/endpoints/delete-user.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { z } from "zod";
import { noContentFactory } from "../factories";

/** @desc The endpoint demonstrates no content response established by its factory */
export const deleteUserEndpoint = noContentFactory.buildEmpty({
export const deleteUserEndpoint = noContentFactory.buildVoid({
method: "delete",
tag: "users",
input: z.object({
2 changes: 1 addition & 1 deletion src/endpoints-factory.ts
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ export class EndpointsFactory<
});
}

public buildEmpty<BIN extends IOSchema = EmptySchema>({
public buildVoid<BIN extends IOSchema = EmptySchema>({
handler,
...rest
}: Omit<BuildProps<BIN, z.ZodVoid, IN, OUT, SCO, TAG>, "output">) {
2 changes: 1 addition & 1 deletion tests/unit/endpoint.spec.ts
Original file line number Diff line number Diff line change
@@ -618,7 +618,7 @@ describe("Endpoint", () => {

const endpoint = defaultEndpointsFactory
.addMiddleware(dateInputMiddleware)
.buildEmpty({
.buildVoid({
handler: async ({ input: { middleware_date_input }, logger }) =>
logger.debug(
"date in endpoint handler",
Loading