Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Resolve the scalar for delete type
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien0102 committed Mar 23, 2020
1 parent ffd09d3 commit 3e8f56c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/scripts/import-open-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export const generateRestfulComponent = (

const lastParamInTheRouteType =
!isReference(lastParamInTheRouteDefinition.schema) && lastParamInTheRouteDefinition.schema
? lastParamInTheRouteDefinition.schema.type
? getScalar(lastParamInTheRouteDefinition.schema)
: isReference(lastParamInTheRouteDefinition.schema)
? getRef(lastParamInTheRouteDefinition.schema.$ref)
: "string";
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/tests/__snapshots__/import-open-api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,25 @@ export type UseFindPetByIdProps = Omit<UseGetProps<Pet, void>, \\"path\\"> & {id
export const useFindPetById = ({id, ...props}: UseFindPetByIdProps) => useGet<Pet, Error, void>(\`/pets/\${id}\`, props);
export type DeletePetProps = Omit<MutateProps<void, Error, void, integer>, \\"path\\" | \\"verb\\">;
export type DeletePetProps = Omit<MutateProps<void, Error, void, number>, \\"path\\" | \\"verb\\">;
/**
* deletes a single pet based on the ID supplied
*/
export const DeletePet = (props: DeletePetProps) => (
<Mutate<void, Error, void, integer>
<Mutate<void, Error, void, number>
verb=\\"DELETE\\"
path={\`/pets\`}
{...props}
/>
);
export type UseDeletePetProps = Omit<UseMutateProps<void, void, integer>, \\"path\\" | \\"verb\\">;
export type UseDeletePetProps = Omit<UseMutateProps<void, void, number>, \\"path\\" | \\"verb\\">;
/**
* deletes a single pet based on the ID supplied
*/
export const useDeletePet = (props: UseDeletePetProps) => useMutate<void, Error, void, integer>(\\"DELETE\\", \`/pets\`, props);
export const useDeletePet = (props: UseDeletePetProps) => useMutate<void, Error, void, number>(\\"DELETE\\", \`/pets\`, props);
export type UpdatePetProps = Omit<MutateProps<Pet, Error, void, UpdatePetRequestRequestBody>, \\"path\\" | \\"verb\\"> & {id: number};
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/tests/import-open-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ describe("scripts/import-open-api", () => {
in: "path",
required: true,
description: "The id of the use case",
schema: { type: "number", format: "uuid" },
schema: { type: "integer", format: "uuid" },
},
],
responses: {
Expand Down

0 comments on commit 3e8f56c

Please sign in to comment.