But according to the OpenAPI specification, references can be used at various locations, for example responses.
I know responses are not yet parsed, but I think it should be taken in account for the future.
As I think there are choices to make, I preferred to submit an issue first. I'll submit a PR when this discussion converges to a solution.
Issue
When the OpenAPI schema contains referenced parameters, they are not resolved and not included in the generated SDK.
Here is a test that fails to reproduce this (based on https://github.com/crescat-io/saloon-sdk-generator/blob/master/tests/Samples/spotify.yml) :
For reference, here is the expected SDK (based on the source schema):
Resolution & discussion
At the first attempt, I tried: https://github.com/crescat-io/saloon-sdk-generator/blob/master/src/Parsers/OpenApiParser.php
This amply slows down generation. On my machine, the
SmokeTest
test takes about 12 seconds before the change and times out after (60 seconds)I also found this commit https://github.com/crescat-io/saloon-sdk-generator/commit/bd9d3252962dd4564b558915fd6b1217bf5d5d25 which changes the resolution mode from
RESOLVE_MODE_ALL
toRESOLVE_MODE_INLINE
without explaining why but surely on purpose.My second thought was to resolve references in the
mapPrams
method by overriding context at that time to change itsmode
:But according to the OpenAPI specification, references can be used at various locations, for example responses. I know responses are not yet parsed, but I think it should be taken in account for the future.
As I think there are choices to make, I preferred to submit an issue first. I'll submit a PR when this discussion converges to a solution.