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

generation for response type breaks if same response schema ref is used twice for paths #1135

Open
SimonLudwigNeteleven opened this issue Oct 10, 2024 · 2 comments
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon

Comments

@SimonLudwigNeteleven
Copy link

SimonLudwigNeteleven commented Oct 10, 2024

Description

The command "yarn generate" should create all generated files including "types.gen.ts" without any issues.
The files are generated, but the response type of “B” is broken after the command finishes. This only happens, if both path references in the yaml file are the same for both paths. The first correct one wins, if both are the same.

This behavior breaks the type generation and I could only work around it, by making one path beginning with “http” instead of “https” in my project. This workaround is obviously more hack then a solution and works only for two paths maximum.
You can’t test the hack solution with “http” in stackblitz, because only “https” is allowed for the ref path, but you can reproduce the error.

Steps to reproduce the behavior

  1. Go to my stackblitz example
  2. open the terminal
  3. enter “yarn”
  4. enter “yarn generate”
  5. inspect the generated files (types.gen.ts) in packages/test-api/navigation-api/src-gen

Expected behavior

AResponse and BResponse should be “(unknown)”.

Reproducible example or configuration

https://stackblitz.com/edit/vitejs-vite-6tvzvt?file=packages%2Ftest-api%2Fopenapi-spec%2Fnavigation-api.yaml

OpenAPI specification (optional)

No response

System information (optional)

No response

@SimonLudwigNeteleven SimonLudwigNeteleven added the bug 🔥 Something isn't working label Oct 10, 2024
Copy link

stackblitz bot commented Oct 10, 2024

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

@mrlubos mrlubos added the prioritized 🚚 This issue has been prioritized and will be worked on soon label Oct 10, 2024
@mrlubos
Copy link
Member

mrlubos commented Oct 10, 2024

Nice catch, thanks for reporting @SimonLudwigNeteleven!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon
Projects
None yet
Development

No branches or pull requests

2 participants