libninja icon indicating copy to clipboard operation
libninja copied to clipboard

Stack overflow while generating client from large schema

Open sportfloh opened this issue 2 years ago • 4 comments

Hi, I tried to generate a client for the vSphere Web Services API and I got a stack overflow error:

❯ libninja gen -l rust -g sportfloh/vsphere -o vsphere vsphere ../vi_json_openapi_specification_v8_0_1_0.yaml
...
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
[1]    240 abort      libninja gen -l rust -g sportfloh/vsphere -o vsphere vsphere

vSphere Web Services API OpenAPI Schema

Cheers

sportfloh avatar Aug 29 '23 20:08 sportfloh

Thank you! Can you share the exact link to the yaml? The link points to a huge documentation site, and I can't find the YAML document therein.

kurtbuilds avatar Aug 29 '23 23:08 kurtbuilds

Sorry, yes ofcorse: https://vdc-download.vmware.com/vmwb-repository/dcr-public/f6932c47-5212-4866-b3e7-e29d81a68e51/9b5473f2-3c7f-4ab8-b374-827c8c89388e/vi_json_openapi_spec_v8_0_1_0.zip

sportfloh avatar Aug 30 '23 05:08 sportfloh

Realistically not sure when I'll have time to prioritize this. Happy to answer Qs if you investigate the problem.

kurtbuilds avatar Sep 10 '23 07:09 kurtbuilds

I got this when the the schema was potentially recursive, e.g with a parameter like

struct Item{
   name: String
   related_item: Option<Item>
}

And it was when generating the example that it overflowed (you can kinda see why ;)

Anyway I have a PR with a fix that WorksForMe(tm) or you might find that disabling examples does it for you

pscott31 avatar Nov 27 '23 12:11 pscott31