Closed bobbyshaw closed 8 months ago
@HelgeSverre apologies to add to the same PR but I've built on this functionality further so that it now copes when the OpenAPI base URL has a variable, e.g. https://api-{region}.example.com
.
For my SDK it then generates a connector like so:
public function __construct(
protected string $storeHash,
protected string $authToken,
) {
$this->withTokenAuth($authToken);
}
public function resolveBaseUrl(): string
{
return "https://api.bigcommerce.com/stores/{$this->storeHash}/v3";
}
Very nice, will review this closer later today (or whenever i get time, life etc)
merged in manually to the dev branch, closing this for now.
The goal of this change is to support API key as parameters to Connectors and declaring the authentication mechanism. Only API key authentication is supported at this time, e.g.
I've added some unit tests for the OpenAPI parser and the ConnectorGenerator classes - just for the changed sections at this time.
I had a decision to make during this what classes to create to capture the security schemes and requirements. I appreciate that you also support parsing Postman Collections which I'm less familiar with. Looking at their specification, they appear less comprehensive and less verbose than OpenAPI specs. I've chosen to align the the OpenAPI format as it's likely easier to convert postman to open API format than the other way around without losing fidelity of information.