Comments (6)
I will take a look on this and if its necessary I will make a PR to fix it
from openapi-typescript.
Oh wow, I'm so sorry. I have a repro: https://stackblitz.com/edit/vitejs-vite-3tdy1b?file=src%2FApp.tsx
If body
is undefined
you can reproduce the issue easily in the browser. client.POST('/', {body:undefined})
from openapi-typescript.
Hello! I can't reproduce the bug with the information provided, could you please create a repository where we can test it or let me know if there is another detail when doing the reproduction?
from openapi-typescript.
Perhaps it is related to Bun, Astro, or Vite in some way. I'm not 100% sure where the Request global is being set, but I had assumed it was the browser's. Unfortunately I can't figure out how to install Bun on StackBlitz to dig further into a repro. Regardless, there's clearly some incompatibility in the vast JS/TS ecosystem as a result of overwriting Request
properties that are native to the Request
object Finding some other means of adding them would probably be beneficial for that reason.
For example:
const nativeRequest = new Request()
class CustomRequest extends Request {
constructor(input, init) {
super(input, init);
// add custom parameters
for (const key in init) {
if (!(key in nativeRequest)) {
this[key] = init[key];
}
}
}
}
Or
class CustomRequest extends Request {
constructor(input, init) {
super(input, init);
// add custom parameters
for (const key in init) {
if (!(key in this)) {
this[key] = init[key];
}
}
}
}
from openapi-typescript.
Since body
can be undefined
, I'm guessing the naive check agains !this["body"]
in the CustomRequest
object is returning a false positive, while key in this
would not return a false positive.
from openapi-typescript.
Alr makes sense https://github.com/drwpow/openapi-typescript/blob/main/packages/openapi-fetch/src/index.js#L17 return a false positive, you could do the PR fixing this by changing that conditional to !(key in this)
from openapi-typescript.
Related Issues (20)
- Headers passed in createClient not getting omitted from the headers in Client methods. HOT 1
- Transform only transforms referenced schemas HOT 1
- Hoping to wrap the client for single arg calls
- Metadata generation
- Allow client option for custom dispatcher into fetch requests (e.g. to disable certificate validation) HOT 6
- advice on how to connect a frontend (swagger?) while using this lib
- Set baseUrl per request
- 0.9.4 breaks some Typescript configurations HOT 3
- Response types from openapi-fetch ignore null values
- Multiple security schemes not supported
- With React Query: Invariant: headers() expects to have requestAsyncStorage, none available. HOT 3
- `--properties-required-by-default` and `--default-non-nullable` flags do not work HOT 1
- Nested object's properties are mapped to unknown, but in OpenAPI they are typed correctly HOT 3
- "AdditionalProperties" reflects onto existing properties and causes TypeScript compile errors HOT 1
- Issues with references (`$ref`) resolution HOT 2
- Error with negative numbers in enums HOT 2
- Allow for custom types in path params serialization (and maybe other places serialization too)
- Types derived for oneOf construct result in TS2502 error HOT 7
- 'path' does not exist in type '{ query?: Record<string, unknown> | undefined; }' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-typescript.