Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,51 @@ interface ModelInterface
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string,string>
*/
public static function openAPITypes(): array;

/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string,string|null>
*/
public static function openAPIFormats(): array;

/**
* Array of attributes where the key is the local name, and the value is the original name
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string,string>
*/
public static function attributeMap(): array;

/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string,string>
*/
public static function setters(): array;

/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string,string>
*/
public static function getters(): array;

/**
* Show all the invalid properties with reasons.
*
* @return array
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties(): array;

/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool
* @return bool True if all properties are valid
*/
public function valid(): bool;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,15 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
protected array $openAPINullablesSetToNull = [];

/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function openAPITypes(): array
{
return self::$openAPITypes{{#parentSchema}} + parent::openAPITypes(){{/parentSchema}};
}

/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function openAPIFormats(): array
{
Expand Down Expand Up @@ -97,21 +93,15 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}

/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
* {@inheritdoc}
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}

/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
* {@inheritdoc}
*/
public function isNullableSetToNull(string $property): bool
{
Expand Down Expand Up @@ -150,40 +140,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
];

/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function attributeMap(): array
{
return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap;
}

/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function setters(): array
{
return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters;
}

/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function getters(): array
{
return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters;
}

/**
* The original name of the model.
*
* @return string
* {@inheritdoc}
*/
public function getModelName(): string
{
Expand Down Expand Up @@ -280,9 +261,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}

/**
* Show all the invalid properties with reasons.
*
* @return string[] invalid properties with reasons
* {@inheritdoc}
*/
public function listInvalidProperties(): array
{
Expand Down Expand Up @@ -361,10 +340,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}

/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
* {@inheritdoc}
*/
public function valid(): bool
{
Expand Down
44 changes: 10 additions & 34 deletions samples/client/echo_api/php-nextgen-streaming/src/Model/Bird.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,15 @@ class Bird implements ModelInterface, ArrayAccess, JsonSerializable
protected array $openAPINullablesSetToNull = [];

/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function openAPITypes(): array
{
return self::$openAPITypes;
}

/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function openAPIFormats(): array
{
Expand Down Expand Up @@ -141,21 +137,15 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull):
}

/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
* {@inheritdoc}
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}

/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
* {@inheritdoc}
*/
public function isNullableSetToNull(string $property): bool
{
Expand Down Expand Up @@ -194,40 +184,31 @@ public function isNullableSetToNull(string $property): bool
];

/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function attributeMap(): array
{
return self::$attributeMap;
}

/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function setters(): array
{
return self::$setters;
}

/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array<string, string>
* {@inheritdoc}
*/
public static function getters(): array
{
return self::$getters;
}

/**
* The original name of the model.
*
* @return string
* {@inheritdoc}
*/
public function getModelName(): string
{
Expand Down Expand Up @@ -272,9 +253,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default
}

/**
* Show all the invalid properties with reasons.
*
* @return string[] invalid properties with reasons
* {@inheritdoc}
*/
public function listInvalidProperties(): array
{
Expand All @@ -284,10 +263,7 @@ public function listInvalidProperties(): array
}

/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
* {@inheritdoc}
*/
public function valid(): bool
{
Expand Down
Loading
Loading