Illegal Instruction: 4 on valid OAS 3.0
dskvr opened this issue · comments
Unfortunately, I have nothing else to report because using --verbose
does not result in any additional information. My gut feeling tells me swaggen doesn't account for any
types (ie: {}
), which are valid OAS 3.0 types.
$ swagger-cli validate swagger/chain.yaml
swagger/chain.yaml is valid
$ swaggen generate swagger/chain.yaml
Illegal Instruction: 4
$ swaggen version
Version: 4.0.0
Update:
chain.yaml
includes local references, so I tried a bundled/dereferenced version of the same specification with the exact same result.
Hi @dskvr, thanks for the report. Unfortunately without a an example spec I can’t debug this. If you could put together an example that fails that would be great.
Sure thing @yonaskolb, here's a dereferenced version of the specification.
bundled-deref.yaml.zip
Thanks @dskvr. Looks like the issue is the empty security:
security:
- {}
If that is removed it's all good.
That obviously shouldn't crash the parser, and will be fixed, but as a workaround you can just remove that
Thanks!
Is there a good way to debug SwagGen on my own?
To debug in Xcode you can checkout the repo and then
swift package generate-xcodeproj
Then in the swaggen scheme you can add a command line option
generate path/to/spec.yml
And then just run
Thanks @yonaskolb!
Sidenote:
I got Swaggen to generate, but the serialization logic appears to stop if it hits an anyOf
member. In my case, it creates a public var trx
with type Trx
but Trx does not exist.
The spec I've provided is a pretty extreme case, it trips up serialization of almost every code generator I've come across aside from throwing the json-schemas
(models) that make up this OAS spec into quicktype.io. It's entirely possible something is amidst in the spec despite validation (we all know how OAS 3.0 is right now...)
When I've isolated the cause in a way that can be succinctly expressed, I'll open a new issue.
Thanks for your help!
Reopening this as the crash is still an issue that needs to be fixed