Skip to content

Commit 22fcde8

Browse files
committed
fixed nullable referenced models in schemas
1 parent 8353a18 commit 22fcde8

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed

generated/harvest-openapi.yaml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ components:
210210
type: boolean
211211
description: 'Whether the approval module is enabled.'
212212
nullable: true
213+
team_feature:
214+
type: boolean
215+
description: 'Whether the team module is enabled.'
216+
nullable: true
213217
InvoiceMessage:
214218
type: object
215219
externalDocs:
@@ -991,10 +995,14 @@ components:
991995
type: string
992996
nullable: true
993997
user_assignment:
994-
type: object
995998
description: 'A user assignment object of the user that recorded the expense.'
996999
nullable: true
997-
$ref: '#/components/schemas/UserAssignment'
1000+
anyOf:
1001+
-
1002+
type: object
1003+
$ref: '#/components/schemas/UserAssignment'
1004+
-
1005+
type: 'null'
9981006
receipt:
9991007
type: object
10001008
description: 'An object containing the expense’s receipt URL and file name.'
@@ -1180,10 +1188,14 @@ components:
11801188
type: string
11811189
nullable: true
11821190
user_assignment:
1183-
type: object
11841191
description: 'A user assignment object of the associated user.'
11851192
nullable: true
1186-
$ref: '#/components/schemas/UserAssignment'
1193+
anyOf:
1194+
-
1195+
type: object
1196+
$ref: '#/components/schemas/UserAssignment'
1197+
-
1198+
type: 'null'
11871199
client:
11881200
type: object
11891201
description: 'An object containing the id and name of the associated client.'
@@ -1218,10 +1230,14 @@ components:
12181230
type: string
12191231
nullable: true
12201232
task_assignment:
1221-
type: object
12221233
description: 'A task assignment object of the associated task.'
12231234
nullable: true
1224-
$ref: '#/components/schemas/TaskAssignment'
1235+
anyOf:
1236+
-
1237+
type: object
1238+
$ref: '#/components/schemas/TaskAssignment'
1239+
-
1240+
type: 'null'
12251241
external_reference:
12261242
type: object
12271243
description: 'An object containing the id, group_id, account_id, permalink, service, and service_icon_url of the associated external reference.'
@@ -5727,7 +5743,7 @@ paths:
57275743
patch:
57285744
summary: 'Update an expense'
57295745
operationId: updateExpense
5730-
description: 'Updates the specific expense by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an expense object and a 200 OK response code if the call succeeded.'
5746+
description: "Updates the specific expense by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an expense object and a 200 OK response code if the call succeeded.\n\nNote that changes to project_id and expense_category_id will be silently dropped if the expense is locked. Users with sufficient permissions are able to update the rest of a locked expense’s attributes."
57315747
externalDocs:
57325748
description: 'Update an expense'
57335749
url: 'https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#update-an-expense'
@@ -6229,17 +6245,17 @@ paths:
62296245
id: 14308069
62306246
name: 'Online Store - Phase 1'
62316247
code: OS1
6232-
per_page: 2000
6248+
per_page: 100
62336249
total_pages: 1
62346250
total_entries: 2
62356251
next_page: null
62366252
previous_page: null
62376253
page: 1
62386254
links:
6239-
first: 'https://api.harvestapp.com/v2/invoices?page=1&per_page=2000'
6255+
first: 'https://api.harvestapp.com/v2/invoices?page=1&per_page=100'
62406256
next: null
62416257
previous: null
6242-
last: 'https://api.harvestapp.com/v2/invoices?page=1&per_page=2000'
6258+
last: 'https://api.harvestapp.com/v2/invoices?page=1&per_page=100'
62436259
default:
62446260
description: 'error payload'
62456261
content:
@@ -6291,14 +6307,14 @@ paths:
62916307
type: string
62926308
-
62936309
name: page
6294-
description: 'The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)'
6310+
description: 'The page number to use in pagination. For instance, if you make a list request and receive 100 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)'
62956311
required: false
62966312
in: query
62976313
schema:
62986314
type: integer
62996315
-
63006316
name: per_page
6301-
description: 'The number of records to return per page. Can range between 1 and 2000. (Default: 2000)'
6317+
description: 'The number of records to return per page. Can range between 1 and 2000. (Default: 100)'
63026318
required: false
63036319
in: query
63046320
schema:
@@ -9548,7 +9564,7 @@ paths:
95489564
type: string
95499565
-
95509566
name: include_fixed_fee
9551-
description: 'Whether or not to include fixed-fee projects in the response. (Default: true)'
9567+
description: 'Whether or not to include fixed-fee projects in the response. Fixed-fee uninvoiced fee amount will show as long as the selected date range is on or after the project start date (If project start date is not specified, it is project creation date). Otherwise, it will be 0. (Default: true)'
95529568
required: false
95539569
in: query
95549570
schema:

src/Extractor/Extractor.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,20 @@ private function buildItemsTypes()
971971

972972
if (isset($property['objectoftype'])) {
973973
if (isset($this->definitions[$property['objectoftype']])) {
974-
$this->definitions[$definitionName]['properties'][$propertyName]['$ref'] = '#/components/schemas/'.$property['objectoftype'];
974+
if (isset($property['nullable']) && true === $property['nullable']) {
975+
unset($this->definitions[$definitionName]['properties'][$propertyName]['type']);
976+
$this->definitions[$definitionName]['properties'][$propertyName]['anyOf'] = [
977+
[
978+
'type' => 'object',
979+
'$ref' => '#/components/schemas/'.$property['objectoftype'],
980+
],
981+
[
982+
'type' => 'null',
983+
],
984+
];
985+
} else {
986+
$this->definitions[$definitionName]['properties'][$propertyName]['$ref'] = '#/components/schemas/'.$property['objectoftype'];
987+
}
975988
}
976989

977990
unset($this->definitions[$definitionName]['properties'][$propertyName]['objectoftype']);

0 commit comments

Comments
 (0)