- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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 });
DarkC0der11seriouslag
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]V1 ommits put, and delete requests[/-][+]V1 ommits put and delete requests[/+]DarkC0der11 commentedon Apr 17, 2024
Same problem here.
seriouslag commentedon Apr 17, 2024
@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 commentedon Apr 17, 2024
Yes before v1.0.0 get, post, delete and put generated.
seriouslag commentedon Apr 17, 2024
Opened a PR to generate mutations for PUT, PATCH, and DELETE requests. #74
seriouslag commentedon Apr 20, 2024
Released a test version with this patch under: @seriouslag/openapi-react-query-codegen@next
Until we merge the patches into this repo 😀