openapi-ts: (Fixed) Throws URIError: URI malformed error
Description
After migrating from openapi-typescript-codegen I am unable to regenerate my API service.
✨ Creating Fetch client
URIError: URI malformed
at decodeURIComponent (<anonymous>)
at Dr (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:150482)
at file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:158964
at Array.map (<anonymous>)
at lo.toString (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:158956)
at lo.write (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:159026)
at Object.yo [as fn] (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:162040)
at bo (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:165420)
at async Ro (file:///C:/project/node_modules/@hey-api/openapi-ts/dist/node/index.js:1:171582)
at async start (file:///C:/project/node_modules/@hey-api/openapi-ts/bin/index.js:62:9)
I’ve played around with a number of configuration options but can’t get past this point.
OpenAPI specification (optional)
{
"openapi": "3.0.1",
"info": {
"title": "Api",
"version": "v1"
},
...
}
Configuration
import { defineConfig } from "@hey-api/openapi-ts";
export default defineConfig({
input: "swagger.json",
output: "src/services",
client: "fetch",
});
System information (optional)
- Windows 10
- NodeJS v21.7.1
- npm 10.2.0
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Reactions: 1
- Comments: 17 (9 by maintainers)
@jordanshatford I will assign it to you because you worked with encoder/decoder
@mrlubos Just ran with the
--debugflag. It looks like the errors are coming from my models with%in their descriptions.@mrlubos I’ve got some work to do migrating away from
useOptions: truebefore I can fully validate everything came out as expected.Thanks again for the help.
@Terit I’ll let Jordan answer your question, but I’ll add that it should never throw. If it throws, something went wrong and while the output may seem right, it’s probably not. We are aggregating TypeScript interfaces into a single file now yes! 🚀
@jordanshatford Thanks for the quick turn around this. I’ll give the latest version a try today.
@Terit I have released 0.36.1 fixing this issue. The generation will no longer throw here. I will note that because I dont have a spec to test with I am unsure where exactly it is failing. If the client comes out malformed with the version, please create a new issue and I can further debug.
Oof, let’s wait for @jordanshatford, he might have a better idea. @Terit out of curiosity, what kind of API is that big? How long does it take you to generate an output with our package?