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

serviceResponse 'response' syntax error in generated code #282

Closed
olliejm opened this issue Apr 7, 2024 · 6 comments · Fixed by #283
Closed

serviceResponse 'response' syntax error in generated code #282

olliejm opened this issue Apr 7, 2024 · 6 comments · Fixed by #283
Labels
bug 🔥 Something isn't working

Comments

@olliejm
Copy link

olliejm commented Apr 7, 2024

Description

When I add serviceResponse: 'response' to get access to full response without having to try/catch for API error handling, my service files end up with the following bad syntax:

import type { ApiResult } from './core/ApiResult;

TypeScript then recognises the return type of all services as essentially being any. After fixing the missing string termination I noticed an additional problem that the ApiResult type was not exported by client/index.ts, meaning I couldn't import the type to use in my application.

OpenAPI specification (optional)

https://api.zoken.app/swagger/v2/swagger.json

Configuration

import type { UserConfig } from '@hey-api/openapi-ts';

const base = 'https://api.zoken.app';

const config: UserConfig = {
  base,
  input: `${base}/swagger/v2/swagger.json`,
  output: './openapi',
  serviceResponse: 'response',
};

export default config;

System information (optional)

macOS Sonoma 14.4.1, Node v20.11.1

@olliejm olliejm added the bug 🔥 Something isn't working label Apr 7, 2024
@mrlubos
Copy link
Member

mrlubos commented Apr 7, 2024

Thanks for reporting @olliejm! @jordanshatford will you be able to look into this?

@jordanshatford
Copy link
Collaborator

@olliejm what version of the package are you using?

@olliejm
Copy link
Author

olliejm commented Apr 7, 2024

Version 0.34.5

@jordanshatford
Copy link
Collaborator

@olliejm this is fixed and will be included in the next release

cc: @mrlubos as he will be releasing it

@jordanshatford
Copy link
Collaborator

@olliejm this has just been fixed in v0.35.0 of the package

@olliejm
Copy link
Author

olliejm commented Apr 8, 2024

Great, it works now. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants