Skip to content

V1 ommits put and delete requests #70

@bryanjtc

Description

@bryanjtc
Contributor

Here are some examples. The last one is not being generated.

"/api/v1/Catalogs/GetByStatus/{status}": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Returns catalogs by status. (Auth)",
        "operationId": "GetCatalogsByStatus",
        "parameters": [
          {
            "name": "status",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Catalogs"
                  }
                }
              }
            }
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing GetByStatus"
          }
        }
      }
    },
    "/api/v1/Catalogs/GetByDescription/{description}": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Returns catalogs by description. (Auth)",
        "operationId": "GetCatalogsByDescription",
        "parameters": [
          {
            "name": "description",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Catalogs"
                  }
                }
              }
            }
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing GetByStatus"
          }
        }
      }
    },
    "/api/v1/Catalogs/GroupByColumn/{column}": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Returns catalogs by column. (Auth)",
        "operationId": "GetCatalogsGroupByColumn",
        "parameters": [
          {
            "name": "column",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Catalogs"
                  }
                }
              }
            }
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing GroupByColumn"
          }
        }
      }
    },
    "/api/v1/Catalogs/{type}": {
      "get": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Returns catalogs by type. (Auth)",
        "operationId": "GetCatalogs",
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Catalogs"
                  }
                }
              }
            }
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing GetCatalogs"
          }
        }
      }
    },
    "/api/v1/Catalogs": {
      "post": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Create a new catalog. (Auth)",
        "operationId": "PostCatalogs",
        "parameters": [
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Catalogs"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Catalog created succesfully."
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing PostCatalogs"
          }
        }
      }
    },
    "/api/v1/Catalogs/{sequential}": {
      "put": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Update an existing catalog. (Auth)",
        "operationId": "PutCatalogs",
        "parameters": [
          {
            "name": "sequential",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Catalogs"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Catalog updated succesfully."
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing PutCatalogs"
          }
        }
      },
      "delete": {
        "tags": [
          "Catalogs"
        ],
        "summary": "Delete an existing catalog. (Auth)",
        "operationId": "DeleteCatalogs",
        "parameters": [
          {
            "name": "sequential",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-DB-Catalog",
            "in": "header",
            "description": "Database catalog",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog deleted succesfully."
          },
          "400": {
            "description": "No results found."
          },
          "404": {
            "description": "An error occurred while executing DeleteCatalogs"
          }
        }
      }
    },

queries.ts output

export const useCatalogsServiceGetCatalogsByStatus = <TData = Common.CatalogsServiceGetCatalogsByStatusDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ status, xDbCatalog }: {
    status: string;
    xDbCatalog: string;
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn" | "initialData">) => useQuery<TData, TError>({ queryKey: [Common.useCatalogsServiceGetCatalogsByStatusKey, ...(queryKey ?? [{ status, xDbCatalog }])], queryFn: () => CatalogsService.getCatalogsByStatus({ status, xDbCatalog }) as TData, ...options });
export const useCatalogsServiceGetCatalogsByDescription = <TData = Common.CatalogsServiceGetCatalogsByDescriptionDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ description, xDbCatalog }: {
    description: string;
    xDbCatalog: string;
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn" | "initialData">) => useQuery<TData, TError>({ queryKey: [Common.useCatalogsServiceGetCatalogsByDescriptionKey, ...(queryKey ?? [{ description, xDbCatalog }])], queryFn: () => CatalogsService.getCatalogsByDescription({ description, xDbCatalog }) as TData, ...options });
export const useCatalogsServiceGetCatalogsGroupByColumn = <TData = Common.CatalogsServiceGetCatalogsGroupByColumnDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ column, xDbCatalog }: {
    column: string;
    xDbCatalog: string;
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn" | "initialData">) => useQuery<TData, TError>({ queryKey: [Common.useCatalogsServiceGetCatalogsGroupByColumnKey, ...(queryKey ?? [{ column, xDbCatalog }])], queryFn: () => CatalogsService.getCatalogsGroupByColumn({ column, xDbCatalog }) as TData, ...options });
export const useCatalogsServiceGetCatalogs = <TData = Common.CatalogsServiceGetCatalogsDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ type, xDbCatalog }: {
    type: string;
    xDbCatalog: string;
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn" | "initialData">) => useQuery<TData, TError>({ queryKey: [Common.useCatalogsServiceGetCatalogsKey, ...(queryKey ?? [{ type, xDbCatalog }])], queryFn: () => CatalogsService.getCatalogs({ type, xDbCatalog }) as TData, ...options });
export const useCatalogsServicePostCatalogs = <TData = Common.CatalogsServicePostCatalogsMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
    requestBody?: Catalogs;
    xDbCatalog: string;
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
    requestBody?: Catalogs;
    xDbCatalog: string;
}, TContext>({ mutationFn: ({ requestBody, xDbCatalog }) => CatalogsService.postCatalogs({ requestBody, xDbCatalog }) as unknown as Promise<TData>, ...options });

Activity

changed the title [-]V1 ommits put, and delete requests[/-] [+]V1 ommits put and delete requests[/+] on Apr 17, 2024
DarkC0der11

DarkC0der11 commented on Apr 17, 2024

@DarkC0der11

Same problem here.

seriouslag

seriouslag commented on Apr 17, 2024

@seriouslag
Collaborator

@bryanjtc, @DarkC0der11, sorry you all are having issues.
Thank you for providing a spec file.

Did the hooks generate before v1.0.0?

Currently, the generator only handles GET and POST, but we should be able to support the other methods.

bryanjtc

bryanjtc commented on Apr 17, 2024

@bryanjtc
ContributorAuthor

@bryanjtc, @DarkC0der11, sorry you all are having issues.
Thank you for providing a spec file.

Did the hooks generate before v1.0.0?

Currently, the generator only handles GET and POST, but we should be able to support the other methods.

Yes before v1.0.0 get, post, delete and put generated.

seriouslag

seriouslag commented on Apr 17, 2024

@seriouslag
Collaborator

Opened a PR to generate mutations for PUT, PATCH, and DELETE requests. #74

seriouslag

seriouslag commented on Apr 20, 2024

@seriouslag
Collaborator

Released a test version with this patch under: @seriouslag/openapi-react-query-codegen@next
Until we merge the patches into this repo 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @seriouslag@bryanjtc@DarkC0der11

      Issue actions

        V1 ommits put and delete requests · Issue #70 · 7nohe/openapi-react-query-codegen