Skip to content

Commit 0998d3b

Browse files
committed
Add schema deletions file
1 parent 044255b commit 0998d3b

6 files changed

Lines changed: 29 additions & 4 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"mx": {
3+
"mp": {
4+
"auth": [
5+
"paths.\/v3\/token.post.responses.200.content.application\/json.example"
6+
]
7+
}
8+
},
9+
"us": {
10+
"mp": {
11+
"auth": [
12+
"paths.\/v3\/token.post.responses.200.content.application\/json.example"
13+
]
14+
}
15+
}
16+
}

resources/templates/Configuration.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class Configuration
553553
}
554554
}
555555

556-
/**
556+
/**
557557
* Sign the request with the user's private key
558558
*
559559
* @param string $path The path to the endpoint being called

resources/templates/model_generic.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
class {{classname}} extends BaseModel
22
{
33
{{~#if vendorExtensions.x-expose-headers}}
4-
use HasResponseHeaders;{{/if}}
4+
use HasResponseHeaders;
55

6+
{{/if~}}
67
public const DISCRIMINATOR = {{#if discriminator}}'{{discriminatorName}}'{{else}}null{{/if}};
78

89
/**

src/Configuration.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,14 @@ protected function validateOptions(array $options): void
551551
}
552552

553553
foreach ($validKeys as $key) {
554-
if (!isset($options[$key]) || $options[$key] === null) continue;
554+
if (!isset($options[$key]) || $options[$key] === null) {
555+
continue;
556+
}
555557
$this->{'set' . ucfirst($key)}($options[$key]);
556558
}
557559
}
558560

559-
/**
561+
/**
560562
* Sign the request with the user's private key
561563
*
562564
* @param string $path The path to the endpoint being called

utils/constants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
const SCHEMA_ADDITIONS_FILE = MODEL_MODIFICATIONS_DIR . '/additions.json';
2020
// The attributes in this file replace any corresponding attributes in the models
2121
const SCHEMA_REPLACEMENTS_FILE = MODEL_MODIFICATIONS_DIR . '/replacements.json';
22+
// The attributes in this file are removed from the models
23+
const SCHEMA_DELETIONS_FILE = MODEL_MODIFICATIONS_DIR . '/deletions.json';
2224

2325
const ACCESS_TOKEN_HEADER = 'WM_SEC.ACCESS_TOKEN';
2426
const AUTH_SIG_HEADER = 'WM_SEC.AUTH_SIGNATURE';

utils/customize-schemas.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ function chooseContentType(array $content): string
446446
*/
447447
function fixSchema(array $schema, string $country, string $category, string $code): array
448448
{
449+
$allDeletions = json_decode(file_get_contents(SCHEMA_DELETIONS_FILE), true);
450+
$deletions = $allDeletions[$country][$category][$code] ?? [];
451+
array_forget($schema, $deletions);
452+
449453
$allReplacements = json_decode(file_get_contents(SCHEMA_REPLACEMENTS_FILE), true);
450454
$replacements = $allReplacements[$country][$category][$code] ?? [];
451455

0 commit comments

Comments
 (0)