L5-Swagger
L5-Swagger copied to clipboard
Override parent class's property in child
- L5-Swagger Version: 8.1 (
composer show | grep l5-swagger) - PHP Version (
php -v): 7.3.3 - OS: Ubuntu
Description:
I have two classes A and B. A is the base class and B is the extended class. Class A has a QA property with an example. Since class B extends class A, I want to override the QA property that exists in class A with a new example. Is this possible?
To me, it shows an error saying that there is multiple QA property present as I'm using class B as a ref in my documentation.
Steps To Reproduce:
Below is the code for class A:
class A {
/**
* @OA\Property(
* title="success",
* description="Success state",
* example="true"
* )
*
* @var bool
*/
public $success;
/**
* @OA\Property(
* title="message",
* description="A message from server",
* example="Success"
* )
*
* @var string
*/
public $message;
}
Below is the code for class B:
class B extends A {
/**
* @OA\Property(
* title="message",
* description="A message from server",
* example="Successfully created row"
* )
*
* @var string
*/
public $message;
}
I think this is more a question for zircote/swagger-php and how inherited properties are merged. This could be a nice feature, although perhaps optional.. hmmm.