I'm stuck when trying to define settings API documentation. Let's say, that in
@OA\JsonContent()
I need to have two properties - key and value. But properties are strictly defined as
key => type of the value
scoring.password.length => boolean
scoring.entity.device => boolean
scoring.twofactor_when_score_gte => integer
How to write @OA\Property for this pairs?
I've tried e.g. this, but it is not ideal as value is key-independent and in Redocly it looks really terrible (an key names are not visible):
@OA\RequestBody(
* required=true,
* description="Pass setting key-value pair",
* @OA\JsonContent(
* required={"key", "value"},
* @OA\Property(property="key", type="object",
* @OA\AdditionalProperties(type="array",
* @OA\Items(oneOf={
* @OA\Property(property="scoring.password.length", type="bool"),
* @OA\Property(property="scoring.password.complexity.symbols", type="bool"),
* @OA\Property(property="scoring.password.complexity.mixed_case", type="bool"),
* @OA\Property(property="scoring.password.leaks", type="bool"),
* @OA\Property(property="scoring.password.complexity.letters", type="bool"),
* @OA\Property(property="scoring.password.complexity.numbers", type="bool"),
* @OA\Property(property="scoring.entity.device", type="bool"),
* @OA\Property(property="scoring.entity.geodata", type="bool"),
* @OA\Property(property="scoring.entity.disposable_email", type="bool"),
* @OA\Property(property="scoring.entity.leaks.phone", type="bool"),
* @OA\Property(property="scoring.entity.leaks.email", type="bool"),
* @OA\Property(property="scoring.entity.blacklist", type="bool"),
* @OA\Property(property="scoring.twofactor_when_score_gte", type="integer"),
* @OA\Property(property="scoring.disallow_when_score_gte", type="integer"),
* @OA\Property(property="deny_login.blacklist.email", type="bool"),
* @OA\Property(property="deny_login.blacklist.domain", type="bool"),
* @OA\Property(property="deny_login.blacklist.ip", type="bool"),
* }
* )
* ),
* ),
* @OA\Property(property="value", type="string", description="The value of the setting (int|string|bool)"),
* ),