From d8ffbfdef7edf5ae7b4d3fd57e0a9388757d6c63 Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Mon, 16 Dec 2024 18:36:32 +0100 Subject: [PATCH] fix: baseURL could be undefined, do not throw error if that is the case --- .changeset/famous-keys-eat.md | 5 + .changeset/large-boxes-itch.md | 5 + docs/changelog.md | 4 + e2e/package.json | 2 +- examples/advanced/package.json | 4 +- examples/advanced/petStore.yaml | 5 + examples/advanced/src/gen/docs.html | 12 +- .../advanced/src/gen/models/ts/tag/Tag.ts | 7 + .../src/gen/schemas/addPetRequest.json | 6 +- examples/advanced/src/gen/schemas/pet.json | 6 +- examples/advanced/src/gen/schemas/tagTag.json | 6 +- .../src/gen/schemas2/addPetRequest.json | 6 +- examples/advanced/src/gen/schemas2/pet.json | 6 +- .../advanced/src/gen/schemas2/tagTag.json | 6 +- .../advanced/src/gen/zod/tag/tagSchema.ts | 2 +- examples/faker/src/gen/models/User.ts | 1 + examples/msw/package.json | 2 +- examples/react-query/package.json | 2 +- examples/react/package.json | 2 +- examples/zod/src/gen/ts/PetType.ts | 1 + packages/core/package.json | 2 +- packages/oas/package.json | 2 +- packages/parser-ts/package.json | 2 +- packages/parser-ts/src/factory.ts | 8 +- packages/plugin-client/src/clients/fetch.ts | 2 +- packages/plugin-oas/package.json | 2 +- packages/plugin-react-query/package.json | 2 +- packages/plugin-solid-query/package.json | 2 +- packages/plugin-svelte-query/package.json | 2 +- packages/plugin-swr/package.json | 2 +- .../src/__snapshots__/parser.test.ts.snap | 35 +++- packages/plugin-ts/src/components/Type.tsx | 22 ++- .../src/generators/typeGenerator.tsx | 2 + packages/plugin-ts/src/parser.ts | 6 + packages/plugin-vue-query/package.json | 2 +- pnpm-lock.yaml | 164 +++++++++--------- pnpm-workspace.yaml | 39 ++--- 37 files changed, 240 insertions(+), 146 deletions(-) create mode 100644 .changeset/famous-keys-eat.md create mode 100644 .changeset/large-boxes-itch.md diff --git a/.changeset/famous-keys-eat.md b/.changeset/famous-keys-eat.md new file mode 100644 index 000000000..179c701cd --- /dev/null +++ b/.changeset/famous-keys-eat.md @@ -0,0 +1,5 @@ +--- +"@kubb/plugin-client": patch +--- + +baseURL could be undefined, do not throw error if that is the case diff --git a/.changeset/large-boxes-itch.md b/.changeset/large-boxes-itch.md new file mode 100644 index 000000000..aef1eaee1 --- /dev/null +++ b/.changeset/large-boxes-itch.md @@ -0,0 +1,5 @@ +--- +"@kubb/plugin-ts": patch +--- + +minLength, maxLength, pattern as part of the jsdocs diff --git a/docs/changelog.md b/docs/changelog.md index 10888f10c..c581bbb2c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,10 @@ title: Changelog # Changelog +## 3.3.4 +- [`plugin-ts`](/plugins/plugin-ts): minLength, maxLength, pattern as part of the jsdocs +- [`plugin-client`](/plugins/plugin-client): baseURL could be undefined, do not throw error if that is the case + ## 3.3.3 - [`react`](/helpers/react/): Use of `@kubb/react` as importSource for jsx(React 17, React 18, React 19 could be used next to Kubb) - [`cli`](/helpers/cli/): Use of `@kubb/react` as importSource for jsx(React 17, React 18, React 19 could be used next to Kubb) diff --git a/e2e/package.json b/e2e/package.json index 656e13e99..cae49ad07 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -37,7 +37,7 @@ "@tanstack/svelte-query": "^5.62.7", "@tanstack/vue-query": "^5.62.7", "axios": "^1.7.9", - "msw": "^2.6.8", + "msw": "^2.6.9", "react": "catalog:", "solid-js": "^1.9.3", "svelte": "^3.59.2", diff --git a/examples/advanced/package.json b/examples/advanced/package.json index 2f78697c7..fe2e49281 100644 --- a/examples/advanced/package.json +++ b/examples/advanced/package.json @@ -43,9 +43,9 @@ "@tanstack/solid-query": "^5.62.7", "@tanstack/svelte-query": "^5.62.7", "@tanstack/vue-query": "^5.62.7", - "axios": "^1.7.9", - "msw": "^2.6.8", "@types/react": "^19.0.1", + "axios": "^1.7.9", + "msw": "^2.6.9", "react": "^19.0.0", "solid-js": "^1.9.3", "svelte": "^3.59.2", diff --git a/examples/advanced/petStore.yaml b/examples/advanced/petStore.yaml index 6b95cd7e9..7c19403d3 100644 --- a/examples/advanced/petStore.yaml +++ b/examples/advanced/petStore.yaml @@ -844,11 +844,16 @@ components: xml: name: user tag.Tag: + deprecated: true type: object properties: id: type: integer format: int64 + minLength: 5 + maxLength: 7 + default: 1 + deprecated: true name: type: string xml: diff --git a/examples/advanced/src/gen/docs.html b/examples/advanced/src/gen/docs.html index a47c74181..0942c04f9 100644 --- a/examples/advanced/src/gen/docs.html +++ b/examples/advanced/src/gen/docs.html @@ -471,7 +471,7 @@ " class="sc-epnzzT sc-eMwmJz drsioI dWZUhK sc-drVZOg jtjIAv">

Pet not found

Request samples

Content type
{
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Add a new pet to the store

Request samples

Content type
{
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Add a new pet to the store

Add a new pet to the store

Authorizations:
petstore_auth
Request Body schema:
required

Create a new pet in the store

@@ -481,13 +481,13 @@ " class="sc-epnzzT sc-eMwmJz drsioI dWZUhK sc-drVZOg jtjIAv">

Successful operation

Request samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Finds Pets by status

Request samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Finds Pets by status

Multiple status values can be provided with comma separated strings

Authorizations:
petstore_auth
path Parameters
step_id
required
string

Responses

Response samples

Content type
[
  • {
    }
]

Finds Pets by tags

Response samples

Content type
[
  • {
    }
]

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Authorizations:
petstore_auth
query Parameters
tags
Array of strings

Tags to filter by

@@ -501,7 +501,7 @@ " class="sc-epnzzT sc-eMwmJz drsioI dWZUhK sc-drVZOg jtjIAv">

successful operation

Response samples

Content type
[
  • {
    }
]

Find pet by ID

Response samples

Content type
[
  • {
    }
]

Find pet by ID

Returns a single pet

Authorizations:
api_keypetstore_auth
path Parameters
petId
required
integer <int64>

ID of pet to return

@@ -511,7 +511,7 @@ " class="sc-epnzzT sc-eMwmJz drsioI dWZUhK sc-drVZOg jtjIAv">

Invalid ID supplied

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Updates a pet in the store with form data

Authorizations:
petstore_auth
path Parameters
petId
required
integer <int64>

Response samples

Content type
{
  • "id": 10,
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Updates a pet in the store with form data

Authorizations:
petstore_auth
path Parameters
petId
required
integer <int64>

ID of pet that needs to be updated

query Parameters
name
string

Name of pet that needs to be updated

@@ -645,7 +645,7 @@ " class="sc-epnzzT sc-eMwmJz drsioI dWZUhK sc-drVZOg jtjIAv">

unexpected error

Request samples

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

Response samples

Content type
application/json
null