From e10b59aff004f03f45404b97f4480a3b5fc59d13 Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Wed, 8 Jan 2025 17:49:21 +0100 Subject: [PATCH] fix: min and max was not applied to the faker functions --- .changeset/eight-baboons-hear.md | 5 +++ docs/changelog.md | 3 ++ e2e/package.json | 2 +- examples/advanced/package.json | 2 +- examples/advanced/petStore.yaml | 2 + .../gen/clients/axios/petService/addPet.ts | 2 +- examples/advanced/src/gen/docs.html | 9 +++-- .../src/gen/mocks/createOrderFaker.ts | 2 +- .../src/gen/mocks/tag/createTagFaker.ts | 2 +- examples/advanced/src/gen/models/ts/Order.ts | 2 + examples/advanced/src/gen/schemas/order.json | 2 +- examples/advanced/src/gen/schemas2/order.json | 2 +- examples/advanced/src/gen/zod/orderSchema.ts | 2 +- examples/react-query/package.json | 4 +- examples/simple-single/package.json | 2 +- .../src/__snapshots__/parser.test.ts.snap | 6 +-- packages/plugin-faker/src/parser.ts | 20 +++++----- packages/plugin-ts/src/parser.ts | 2 +- packages/plugin-zod/src/parser.ts | 2 +- pnpm-lock.yaml | 38 +++++++++---------- 20 files changed, 63 insertions(+), 48 deletions(-) create mode 100644 .changeset/eight-baboons-hear.md diff --git a/.changeset/eight-baboons-hear.md b/.changeset/eight-baboons-hear.md new file mode 100644 index 000000000..dd15b07d8 --- /dev/null +++ b/.changeset/eight-baboons-hear.md @@ -0,0 +1,5 @@ +--- +"@kubb/plugin-faker": patch +--- + +min and max was not applied to the faker functions diff --git a/docs/changelog.md b/docs/changelog.md index f43c6f7b9..990e1c0fc 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,9 @@ title: Changelog # Changelog +## 3.4.1 +- [`plugin-faker`](/plugins/plugin-faker): min and max was not applied to the faker functions + ## 3.4.0 - [`plugin-client`](/plugins/plugin-client): decouple URI (with params) from fetching - [`plugin-client`](/plugins/plugin-client): add header in response object diff --git a/e2e/package.json b/e2e/package.json index 611750764..009b6fc79 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -32,7 +32,7 @@ "@kubb/plugin-ts": "workspace:*", "@kubb/plugin-zod": "workspace:*", "@kubb/react": "workspace:*", - "@tanstack/react-query": "^5.62.16", + "@tanstack/react-query": "^5.63.0", "@tanstack/solid-query": "^5.62.16", "@tanstack/svelte-query": "^5.62.16", "@tanstack/vue-query": "^5.62.16", diff --git a/examples/advanced/package.json b/examples/advanced/package.json index d00e02352..e2027b6e5 100644 --- a/examples/advanced/package.json +++ b/examples/advanced/package.json @@ -39,7 +39,7 @@ "@kubb/plugin-zod": "workspace:*", "@kubb/react": "workspace:*", "@tanstack/query-core": "^5.62.16", - "@tanstack/react-query": "^5.62.16", + "@tanstack/react-query": "^5.63.0", "@tanstack/solid-query": "^5.62.16", "@tanstack/svelte-query": "^5.62.16", "@tanstack/vue-query": "^5.62.16", diff --git a/examples/advanced/petStore.yaml b/examples/advanced/petStore.yaml index 7c19403d3..be9e3c98c 100644 --- a/examples/advanced/petStore.yaml +++ b/examples/advanced/petStore.yaml @@ -714,6 +714,8 @@ components: type: integer format: int64 example: 10 + minLength: 3 + maxLength: 100 petId: type: integer format: int64 diff --git a/examples/advanced/src/gen/clients/axios/petService/addPet.ts b/examples/advanced/src/gen/clients/axios/petService/addPet.ts index 1212203f1..4dda73741 100644 --- a/examples/advanced/src/gen/clients/axios/petService/addPet.ts +++ b/examples/advanced/src/gen/clients/axios/petService/addPet.ts @@ -1,6 +1,6 @@ import client from '../../../../axios-client.ts' import type { RequestConfig, ResponseErrorConfig } from '../../../../axios-client.ts' -import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../../../models/ts/petController/AddPet.ts' +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts' export function getAddPetUrl() { return new URL('/pet', 'https://petstore3.swagger.io/api/v3') diff --git a/examples/advanced/src/gen/docs.html b/examples/advanced/src/gen/docs.html index 3e6cc1961..7a4eed649 100644 --- a/examples/advanced/src/gen/docs.html +++ b/examples/advanced/src/gen/docs.html @@ -263,6 +263,9 @@ .cktsMe{border-radius:2px;word-break:break-word;background-color:rgba(51,51,51,0.05);color:rgba(51,51,51,0.9);padding:0 5px;border:1px solid rgba(51,51,51,0.1);font-family:Courier,monospace;}/*!sc*/ +{margin-left:0;}/*!sc*/ data-styled.g66[id="sc-csuDXq"]{content:"cktsMe,"}/*!sc*/ +.IbGQV{border-radius:2px;background-color:rgba(104,104,207,0.05);color:rgba(50,50,159,0.9);margin:0 5px;padding:0 5px;border:1px solid rgba(50,50,159,0.1);}/*!sc*/ ++{margin-left:0;}/*!sc*/ +data-styled.g68[id="sc-eMHqlA"]{content:"IbGQV,"}/*!sc*/ .dhLzNN{margin:1em 0;}/*!sc*/ .dhLzNN a{text-decoration:auto;color:#32329f;}/*!sc*/ .dhLzNN a:visited{color:#32329f;}/*!sc*/ @@ -539,7 +542,7 @@ " class="sc-dODueM sc-eHKghg fhLETC hIcgHh sc-enuJcz ibumEn">

successful operation

Response samples

Content type
application/json
{
  • "property1": 0,
  • "property2": 0
}

Place an order for a pet

Place a new order in the store

-
Request Body schema:
id
integer <int64>
petId
integer <int64>
quantity
integer <int32>
orderType
string
Enum: "foo" "bar"
type
string
Request Body schema:
id
integer <int64> [ 3 .. 100 ] characters
petId
integer <int64>
quantity
integer <int32>
orderType
string
Enum: "foo" "bar"
type
string

Order Status

shipDate
string <date-time>
status
string
Enum: "placed" "approved" "delivered"

Order Status

@@ -551,7 +554,7 @@ " class="sc-dODueM sc-eHKghg fhLETC hIcgHh sc-enuJcz ibumEn">

Invalid input

Request samples

Content type
{
  • "id": 10,
  • "petId": 198772,
  • "quantity": 7,
  • "orderType": "foo",
  • "type": "approved",
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "approved",
  • "http_status": 200,
  • "complete": true
}

Response samples

Content type
application/json
{
  • "id": 10,
  • "petId": 198772,
  • "quantity": 7,
  • "orderType": "foo",
  • "type": "approved",
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "approved",
  • "http_status": 200,
  • "complete": true
}

Place an order for a pet with patch

Place a new order in the store with patch

-
Request Body schema:
id
integer <int64>
petId
integer <int64>
quantity
integer <int32>
orderType
string
Enum: "foo" "bar"
type
string
Request Body schema:
id
integer <int64> [ 3 .. 100 ] characters
petId
integer <int64>
quantity
integer <int32>
orderType
string
Enum: "foo" "bar"
type
string

Order Status

shipDate
string <date-time>
status
string
Enum: "placed" "approved" "delivered"

Order Status

@@ -645,7 +648,7 @@ " class="sc-dODueM sc-eHKghg fhLETC hIcgHh sc-enuJcz ibumEn">

unexpected error

Request samples

Content type
application/json
{
  • "name": "string",
  • "tag": "string"
}

Response samples

Content type
application/json
null