Skip to content

Invalid Typescript schema requested for POST #3

Closed
@bnhovde

Description

@bnhovde

Hi, love this initiative. It's allowed me to remove hundreds of lines of code.

I've got a strange problem trying to wire up a POST request using the standard approach:

export const submitForm = fetcher.path('/form/{formId}/submit').method('post').create();

The Swagger API definition requests formId as a parameter and formFields as the post body, but the returned function requests the following input, a intersection between an object and an array, which is impossible to provide:

image

I might be doing something wrong, but it seems like a potential bug. Here's the type for the request:

"/form/{formId}/submit": {
    post: {
      parameters: {
        path: {
          formId: string;
        };
      };
      responses: {
        /** Success */
        200: {
          content: {
            "text/plain": components["schemas"]["FormModel"];
            "application/json": components["schemas"]["FormModel"];
            "text/json": components["schemas"]["FormModel"];
          };
        };
      };
      requestBody: {
        content: {
          "application/json":
            | components["schemas"]["FormFieldInputModel"][]
            | null;
          "text/json": components["schemas"]["FormFieldInputModel"][] | null;
          "application/*+json":
            | components["schemas"]["FormFieldInputModel"][]
            | null;
        };
      };
    };
  };


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions