Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(swagger-zodios): export endpoints too #749

Conversation

b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Copy link
Contributor

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs b6pzeusbc54tvhw5jgpyw8pwz2x6gs commented Dec 25, 2023

Sometimes it is necessary to use a dynamic baseUrl in a single build.

In this case, it is necessary to create a Zodios instance externally, as shown in the example code below, and therefore it is necessary to export the necessary endpoints.

import { Zodios } from "@zodios/core";
import { endpoints } from '@generated-api/zodios'

const API_SERVER_URL = process.env.API_SERVER_URL
const myAPI = new Zodios(API_SERVER_URL, endpoints)

I also added getAPI, which allows you to create an API instance without endpoints import.

import { getAPI } from '@generated-api/zodios'

const myAPI = getAPI(process.env.API_SERVER_URL)

Copy link

changeset-bot bot commented Dec 25, 2023

⚠️ No Changeset found

Latest commit: 54c3a7e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kubb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2023 2:23pm

Copy link

codesandbox-ci bot commented Dec 25, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 54c3a7e:

Sandbox Source
advanced-pet-store Configuration
faker-pet-store Configuration
msw-pet-store Configuration
msw-v2-pet-store Configuration
react-query-pet-store Configuration
react-query-v5-pet-store Configuration
typescript-pet-store Configuration
simple-single-pet-store Configuration
solid-query-pet-store Configuration
svelte-query-pet-store Configuration
swr-pet-store Configuration
vue-query-pet-store Configuration
vue-query-v5-pet-store Configuration
zod-pet-store Configuration
zodios-pet-store Configuration
client-pet-store Configuration

Copy link

codecov bot commented Dec 25, 2023

Codecov Report

Attention: 79 lines in your changes are missing coverage. Please review.

Comparison is base (99fc0e3) 72.15% compared to head (54c3a7e) 75.51%.
Report is 14 commits behind head on main.

Files Patch % Lines
packages/core/src/BarrelManager.ts 25.58% 32 Missing ⚠️
packages/core/src/FileManager.ts 6.06% 31 Missing ⚠️
packages/parser/src/api.ts 88.23% 6 Missing ⚠️
...ger-tanstack-query/src/components/QueryOptions.tsx 66.66% 5 Missing ⚠️
...ages/swagger-zodios/src/components/Definitions.tsx 0.00% 2 Missing ⚠️
...es/swagger-tanstack-query/src/components/Query.tsx 0.00% 1 Missing ⚠️
packages/swagger-zod/src/ZodGenerator.ts 50.00% 1 Missing ⚠️
packages/swagger-zod/src/zodParser.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #749      +/-   ##
==========================================
+ Coverage   72.15%   75.51%   +3.35%     
==========================================
  Files         126      127       +1     
  Lines       12297    12393      +96     
  Branches     1229     1295      +66     
==========================================
+ Hits         8873     9358     +485     
+ Misses       3415     3031     -384     
+ Partials        9        4       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs b6pzeusbc54tvhw5jgpyw8pwz2x6gs force-pushed the export-endpoinrts-in-swagger-zodios branch from 08aa937 to 54c3a7e Compare December 25, 2023 14:23
@stijnvanhulle stijnvanhulle merged commit 9b9674c into kubb-labs:main Dec 27, 2023
12 of 13 checks passed
@b6pzeusbc54tvhw5jgpyw8pwz2x6gs b6pzeusbc54tvhw5jgpyw8pwz2x6gs deleted the export-endpoinrts-in-swagger-zodios branch December 30, 2023 07:52
@b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Copy link
Contributor Author

@stijnvanhulle Could you please release this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants