mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 13:37:16 +00:00
Unify getDiscriminator to produce a single discriminator object for both
single-key and compound cases. Single-key returns standard {propertyName,
mapping}. Compound falls back to extending the object with x-propertyNames
and x-mapping for multi-property discrimination.
Simplify call sites: OpenAPI3 uses 'discriminator', Swagger2 uses
'x-discriminator' — no more split keys.
Add conditions to all 7 Algo models (AlgoArgon2, AlgoBcrypt, AlgoMd5,
AlgoPhpass, AlgoScrypt, AlgoScryptModified, AlgoSha) to enable
discriminator generation for hashOptions unions.
63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
use Appwrite\Utopia\Response;
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
class AlgoScryptModified extends Model
|
|
{
|
|
public array $conditions = [
|
|
'type' => 'scryptMod',
|
|
];
|
|
|
|
public function __construct()
|
|
{
|
|
$this
|
|
->addRule('type', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Algo type.',
|
|
'default' => 'scryptMod',
|
|
'example' => 'scryptMod',
|
|
])
|
|
->addRule('salt', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Salt used to compute hash.',
|
|
'default' => '',
|
|
'example' => 'UxLMreBr6tYyjQ==',
|
|
])
|
|
->addRule('saltSeparator', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Separator used to compute hash.',
|
|
'default' => '',
|
|
'example' => 'Bw==',
|
|
])
|
|
->addRule('signerKey', [
|
|
'type' => self::TYPE_STRING,
|
|
'description' => 'Key used to compute hash.',
|
|
'default' => '',
|
|
'example' => 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ==',
|
|
])
|
|
;
|
|
}
|
|
|
|
/**
|
|
* Get Name
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return 'AlgoScryptModified';
|
|
}
|
|
|
|
/**
|
|
* Get Type
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getType(): string
|
|
{
|
|
return Response::MODEL_ALGO_SCRYPT_MODIFIED;
|
|
}
|
|
}
|