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

Inconsistency of custom plugins types and documentation #1545

Open
artandrey opened this issue Jan 9, 2025 · 4 comments
Open

Inconsistency of custom plugins types and documentation #1545

artandrey opened this issue Jan 9, 2025 · 4 comments
Labels
bug 🔥 Something isn't working needs info ⏳ Further information is required

Comments

@artandrey
Copy link

Description

I'd like to submit several typing issues that affects development experience of custom plugins. Way of plugin creation explained in the docs is not possible with current types definition.

  1. You should always specify name for plugin when calling defineConfig of custom plugin
    See file 1 issue.ts on stackblitz
    Documentation reference says, that we should not define name, but that is not possible
    https://heyapi.dev/openapi-ts/custom-plugin#usage

Solution: make name optional in defineConfig parameter or just omit it

  1. I am unnable to define plugin in plugins list when I want to define overall configuration using @hey-api/openapi-ts defineConfig function. Please see issue 2.ts file. That is related to restriction of property name type to accept only litterals of official plugins

We should investigate ability to provide (string & {}) as one of the name litterals to achieve support of custom name. If it would be possible to do so without braking official plugin types autocompletion, that would be great

  1. I am unnable to use Plugin.Name type to specify custom plugin name. That is the same issue that was described in 2-nd point and may be resolved alongside with it

Please, let me know your thoughts on this and I will create a PR to resolve those issues
If you would like me to address those issues one by one in multiple PRs, also mention it in your response

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-example-wjxebpjs

OpenAPI specification (optional)

No response

System information (optional)

No response

@artandrey artandrey added the bug 🔥 Something isn't working label Jan 9, 2025
Copy link

stackblitz bot commented Jan 9, 2025

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@mrlubos
Copy link
Member

mrlubos commented Jan 9, 2025

@artandrey Try updating to the latest, this has been fixed #1462

@mrlubos mrlubos added the needs info ⏳ Further information is required label Jan 10, 2025
@artandrey
Copy link
Author

I can confirm that after upgrading to @hey-api/openapi-ts 0.61.2 the 2nd issue is gone, but 1st and 3rd issues are still persist

@mrlubos
Copy link
Member

mrlubos commented Jan 10, 2025

Can you update the StackBlitz example?

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

No branches or pull requests

2 participants