Skip to content

Commit

Permalink
Merge pull request #24 from jolicode/fix/missing-example-schema
Browse files Browse the repository at this point in the history
added the schema for the new invoice message subject and body endpoint
  • Loading branch information
xavierlacot authored Nov 12, 2022
2 parents fb23dad + d407b03 commit 196746e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
22 changes: 22 additions & 0 deletions generated/harvest-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3275,6 +3275,26 @@ components:
type: integer
message:
type: string
InvoiceMessageSubjectAndBody:
type: object
required:
- invoice_id
- subject
- body
- reminder
- thank_you
properties:
invoice_id:
type: integer
format: int32
subject:
type: string
body:
type: string
reminder:
type: boolean
thank_you:
type: boolean
PaginationLinks:
type: object
required:
Expand Down Expand Up @@ -6968,6 +6988,8 @@ paths:
description: 'Retrieve invoice message subject and body for specific invoice'
content:
application/json:
schema:
$ref: '#/components/schemas/InvoiceMessageSubjectAndBody'
example:
invoice_id: 13150403
subject: 'Past due invoice reminder: #1002 from API Examples'
Expand Down
22 changes: 22 additions & 0 deletions src/Dumper/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ public function dump(array $data): array
],
],
],
'InvoiceMessageSubjectAndBody' => [
'type' => 'object',
'required' => ['invoice_id', 'subject', 'body', 'reminder', 'thank_you'],
'properties' => [
'invoice_id' => [
'type' => 'integer',
'format' => 'int32',
],
'subject' => [
'type' => 'string',
],
'body' => [
'type' => 'string',
],
'reminder' => [
'type' => 'boolean',
],
'thank_you' => [
'type' => 'boolean',
],
],
],
'PaginationLinks' => [
'type' => 'object',
'required' => ['first', 'last'],
Expand Down
6 changes: 5 additions & 1 deletion src/Extractor/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,10 @@ public static function guessPathResponseSchema($summary, $title)
return '#/components/schemas/User';
}

if ('Retrieve invoice message subject and body for specific invoice' === $summary) {
return '#/components/schemas/InvoiceMessageSubjectAndBody';
}

return null;
};

Expand Down Expand Up @@ -837,7 +841,7 @@ private function printUnknownDefinitions(array $items)
} elseif ('$ref' === $key) {
$item = substr($item, 21);

if (!isset($this->definitions[$item]) && 'Error' !== $item) {
if (!isset($this->definitions[$item]) && !\in_array($item, ['Error', 'InvoiceMessageSubjectAndBody'], true)) {
throw new \LogicException(sprintf('Unknown definition: %s', $item));
}
}
Expand Down

0 comments on commit 196746e

Please sign in to comment.