Open chrisranderson opened 4 days ago
I'll add stuff here as I learn more:
"@hey-api/openapi-ts": "^0.57.1"
"@hey-api/client-fetch": "0.5.0"
, but I got 8 errors that look like this:❯ tsc
src/generatedClient/services.gen.ts:11:84 - error TS2344: Type 'UpdateEntryData' does not satisfy the constraint '{ url: string; }'.
Property 'url' is missing in type 'UpdateEntryData' but required in type '{ url: string; }'.
11 export const updateEntry = <ThrowOnError extends boolean = false>(options: Options<UpdateEntryData, ThrowOnError>) => {
~~~~~~~~~~~~~~~
node_modules/@hey-api/client-fetch/dist/index.d.ts:163:5
163 url: string;
~~~
'url' is declared here.
npx @hey-api/openapi-ts -i backend/openapi.json -o frontend/src/generatedClient -c @hey-api/client-fetch
. It seems like that isn't pinned to what I have in package.json
?npx @hey-api/openapi-ts@0.53.10 <rest of command>
. Still get the problem with OptionsLegacyParser
with this in package.json
: "@hey-api/client-fetch": "0.4.1"
client-fetch
to 0.5.0 leads to the
TS2344` errors.@mrlubos This might be related to this commit?
Hey @chrisranderson, yes. Broadly, you should be able to resolve these by following the migration notes for v0.57.0 and upgrading both packages to the latest version. In your comment with 8 errors, I see the services.gen.ts
file reference. This file should be deleted and any imports updated, see https://heyapi.dev/openapi-ts/migrating.html#changed-sdk-output-value. One thing I did not note in the migration notes but this might not be affecting you, if you import UpdateEntryData
in your code, you'd need to omit url
from it to avoid seeing new errors, e.g. Omit<UpdateEntryData, 'url'>
to get the same type as before. Let me know if this helps!
this should be backward compatible ? or may be the command we run that pull the latest version causing this errors ?
npx @hey-api/openapi-ts -i http://localhost:8081/openapi.json -o src/common/api/services/backend-v2 -c @hey-api/client-axios
i only have
"@hey-api/client-axios": "^0.2.8",
@mrlubos thanks for the recommendations. What got things working for me:
npx @hey-api/openapi-ts@0.57.1
. FWIW, this was left over from following the quick start.package.json
to the newest versions: "@hey-api/openapi-ts": "0.57.1"
and "@hey-api/client-fetch": "0.5.0"
Sorry, I tried multiple things at once so I'm not sure which of those finally did the trick.
@chrisranderson sounds like the issue is resolved now?
@rpatidar you'd need to update to the latest version, it doesn't detect which client version you're on and base the output on that... maybe will add it later
@chrisranderson I think we should be wiping the whole folder on every run, that would have helped here a bit
Created https://github.com/hey-api/openapi-ts/issues/1347, it will be the default so nothing to do from your side. Thank you for the sponsorship @chrisranderson!
Description
sdk.gen.ts includes this line:
tsc
fails for me:Sharing some basics in case it's an obvious fix, I can provide more info if needed.
Reproducible example or configuration
No response
OpenAPI specification (optional)
3.1.0
System information (optional)
Relevant snippets from package-lock.json: