Closed pepicrft closed 1 month ago
The generated code respects the order specified in your OpenAPI document.
Let me take a look though, we should at least move the default case to the end.
A temporary workaround is to move the default case in the OpenAPI doc.
Well we already have some logic to try to do this, but if you're seeing it not work, then it's likely broken.
If you'd like to open a PR fixing this that'd be much appreciated 🙏
Hey @czechboy0 👋🏼 Thanks for looking into it. I'll go ahead and open a PR :)
@pepicrft So I think you might be using an outdated fork here?
├── swift-openapi-runtime<https://github.com/tuist/swift-openapi-runtime@unspecified>
├── swift-openapi-urlsession<https://github.com/tuist/swift-openapi-urlsession@unspecified>
I just tested your snippet on main and it works correctly. Also thanks @mt-hodaka for adding a snippet test in #554.
Please reopen the issue if you can still reproduce it on the latest version, thanks!
Description
When using default responses in the OpenAPI schema, the generated code for the client places the
default
case at the top of theswitch
, and the compiler yields an errorAdditional 'case' blocks cannot appear after the 'default' block of a 'switch'
.Reproduction
Package version(s)
Expected behavior
I'd expect the
default
to be at the bottom.Environment
Additional information
No response