crescat-io / saloon-sdk-generator

Generate Saloon SDKs from Postman Collections and OpenAPI Specifications.
MIT License
112 stars 18 forks source link

Argument #2 ($schema) must be of type cebe\openapi\spec\Schema #24

Open colinmollenhour opened 7 months ago

colinmollenhour commented 7 months ago

I tried to give the new DTO feature a spin and ran into an issue:

In DtoGenerator.php line 35:

  Crescat\SaloonSdkGenerator\Generators\DtoGenerator::generateDtoClass(): Argument #2 ($schema) must be of type cebe\openapi\spec\Schema, cebe\openap
  i\spec\Reference given, called in phar:///app/vendor/crescat-io/saloon-sdk-generator/builds/sdkgenerator/src/Generators/DtoGenerator.php on line 28

Script sdkgenerator generate:sdk merged.json --type=openapi --name="SaloonConnector" --output=src --namespace=ShipStream\\FedEx --force handling the generate-sdk event returned with error code 1

Let me know if you'd like to take a look at the repo but basically all it does is merge multiple OpenAPI specs into merged.json, apply some sanitization to the spec (e.g. adding tags) then run the sdkgenerator. It worked on version 1.10.0 but does not work on 1.2.0.

Side note: When using "composer require" the default version installed is 1.10, not 1.2 since 1.10 is "newer".. Took me a while to figure out why I wasn't seeing any DTO generated.. :)

colinmollenhour commented 7 months ago

Ahh it appears that the DTO feature just doesn't support oneOf or allOf or $ref or some combination of them..