Open nikspyratos opened 12 months ago
Ahh, this package currently don't support header values.
Want to try to tackle this in a PR, what specifically has to be done is to add a "headers" array to the Endpoint
class similarly to how we do it for these:
// ...
public array $queryParameters = [],
public array $pathParameters = [],
public array $bodyParameters = [],
// ...
Then in the OpenAPI parser it has to be parsed out from the Operation (i'm assuming), here:
https://github.com/crescat-io/saloon-sdk-generator/blob/master/src/Parsers/OpenApiParser.php#L75-L78
Then add code generation in the RequestGenerator
, around here-ish:
I think this one might be fairly simple to implement (famous last words nervous laughter)
Oooh noice, will have a go at it for the headers.
Any idea for the body?
I think the issue about the body is related to #21
š Heyo! Finally got around to working on more of my banking sdk. Thought I'd make an issue for investigation instead of going on socials just for better visibility/tracking.
I'm using the OpenAPI specification files from the bank's API, for example this one. On that page you'll see a download button for the OpenAPI file that I'm using with the generator.
The generator generates all the requests, connectors, etc. correctly. The issues I'm having are that some headers and POST bodies are not being populated in the requests. I'm going to assume this is due to the OpenAPI spec file being quirky and having more complex specs maybe?
Let's take the
Post Category
request for example. The generatedCreateCategory
request class is bare:Meanwhile, the Swagger editor seems to pick the header & body up correctly:
All requests in this api also require an
intermediaryId
header value, but this is not picked up in any of the generation.Command-wise, what I'm running is:
Any ideas? Is the OpenAPI spec file being weird, or am I doing something wrong?