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 @@ -21,31 +21,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
return new self(
{{#vars}}
{{#isDateTime}}
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isDateTime}}
{{#isEnum}}
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isEnum}}
{{#isEnumRef}}
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isEnumRef}}
{{#isModel}}
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isModel}}
{{#isArray}}
{{#items.isEnumRef}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isEnumRef}}
{{#items.isModel}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isModel}}
{{#items.isDateTime}}
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isDateTime}}
{{^items.isEnumRef}}
{{^items.isModel}}
{{^items.isDateTime}}
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
{{/items.isDateTime}}
{{/items.isModel}}
{{/items.isEnumRef}}
Expand All @@ -55,7 +55,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
{{^isModel}}
{{^isArray}}
{{^isDateTime}}
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
{{/isDateTime}}
{{/isArray}}
{{/isModel}}
Expand All @@ -69,19 +69,19 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
return [
{{#vars}}
{{#isDateTime}}
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}},{{/last}}
{{/isDateTime}}
{{#isArray}}
{{#items.isDateTime}}
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}},{{/last}}
{{/items.isDateTime}}
{{^items.isDateTime}}
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
{{/items.isDateTime}}
{{/isArray}}
{{^isDateTime}}
{{^isArray}}
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
{{/isArray}}
{{/isDateTime}}
{{/vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* {{{.}}}
*
{{/appDescription}}
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
*{{#version}} The version of the OpenAPI document: {{{.}}}{{/version}}
*{{#infoEmail}} Contact: {{{.}}}{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RegisterRoutes {
$r = \Flight::request();
{{^vendorExtensions.x-return-type-is-void}}$result = {{/vendorExtensions.x-return-type-is-void}}$handler->{{operationId}}(
{{#vendorExtensions.x-nonFormParams}}
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}}
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}},{{/-last}}
{{/vendorExtensions.x-nonFormParams}}
);
{{^vendorExtensions.x-return-type-is-void}}
Expand All @@ -42,7 +42,7 @@ class RegisterRoutes {
$r = \Flight::request();
$handler->{{operationId}}Stream(
{{#vendorExtensions.x-nonFormParams}}
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}}
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}},{{/-last}}
{{/vendorExtensions.x-nonFormParams}}
);
// ignore return value: streaming expected
Expand Down
14 changes: 7 additions & 7 deletions samples/server/petstore/php-flight/Model/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -76,17 +76,17 @@ public function __construct(?int $code, ?string $type, ?string $message)
public static function fromArray(array $data): self
{
return new self(
$data['code'] ?? null,
$data['type'] ?? null,
$data['message'] ?? null,
$data['code'] ?? null,
$data['type'] ?? null,
$data['message'] ?? null,
);
}

public function jsonSerialize(): mixed {
return [
'code' => $this->code,
'type' => $this->type,
'message' => $this->message,
'code' => $this->code,
'type' => $this->type,
'message' => $this->message,
];
}
}
Expand Down
10 changes: 5 additions & 5 deletions samples/server/petstore/php-flight/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -67,15 +67,15 @@ public function __construct(?int $id, ?string $name)
public static function fromArray(array $data): self
{
return new self(
$data['id'] ?? null,
$data['name'] ?? null,
$data['id'] ?? null,
$data['name'] ?? null,
);
}

public function jsonSerialize(): mixed {
return [
'id' => $this->id,
'name' => $this->name,
'id' => $this->id,
'name' => $this->name,
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down
26 changes: 13 additions & 13 deletions samples/server/petstore/php-flight/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -106,23 +106,23 @@ public function __construct(?int $id, ?int $petId, ?int $quantity, ?\DateTime $s
public static function fromArray(array $data): self
{
return new self(
$data['id'] ?? null,
$data['petId'] ?? null,
$data['quantity'] ?? null,
isset($data['shipDate']) ? new \DateTime($data['shipDate']) : null,
isset($data['status']) ? OrderStatus::tryFrom($data['status']) : null,
$data['complete'] ?? null,
$data['id'] ?? null,
$data['petId'] ?? null,
$data['quantity'] ?? null,
isset($data['shipDate']) ? new \DateTime($data['shipDate']) : null,
isset($data['status']) ? OrderStatus::tryFrom($data['status']) : null,
$data['complete'] ?? null,
);
}

public function jsonSerialize(): mixed {
return [
'id' => $this->id,
'petId' => $this->petId,
'quantity' => $this->quantity,
'shipDate' => $this->shipDate?->format('c'),
'status' => $this->status,
'complete' => $this->complete,
'id' => $this->id,
'petId' => $this->petId,
'quantity' => $this->quantity,
'shipDate' => $this->shipDate?->format('c'),
'status' => $this->status,
'complete' => $this->complete,
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/php-flight/Model/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down
26 changes: 13 additions & 13 deletions samples/server/petstore/php-flight/Model/Pet.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -112,23 +112,23 @@ public function __construct(?int $id, ?Category $category, string $name, array $
public static function fromArray(array $data): self
{
return new self(
$data['id'] ?? null,
isset($data['category']) ? Category::fromArray($data['category']) : null,
$data['name'] ?? null,
$data['photoUrls'] ?? null,
isset($data['tags']) ? array_map(fn($item) => Tag::fromArray($item), $data['tags']) : null,
isset($data['status']) ? PetStatus::tryFrom($data['status']) : null,
$data['id'] ?? null,
isset($data['category']) ? Category::fromArray($data['category']) : null,
$data['name'] ?? null,
$data['photoUrls'] ?? null,
isset($data['tags']) ? array_map(fn($item) => Tag::fromArray($item), $data['tags']) : null,
isset($data['status']) ? PetStatus::tryFrom($data['status']) : null,
);
}

public function jsonSerialize(): mixed {
return [
'id' => $this->id,
'category' => $this->category,
'name' => $this->name,
'photoUrls' => $this->photoUrls,
'tags' => $this->tags,
'status' => $this->status,
'id' => $this->id,
'category' => $this->category,
'name' => $this->name,
'photoUrls' => $this->photoUrls,
'tags' => $this->tags,
'status' => $this->status,
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/php-flight/Model/PetStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down
10 changes: 5 additions & 5 deletions samples/server/petstore/php-flight/Model/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -66,15 +66,15 @@ public function __construct(?int $id, ?string $name)
public static function fromArray(array $data): self
{
return new self(
$data['id'] ?? null,
$data['name'] ?? null,
$data['id'] ?? null,
$data['name'] ?? null,
);
}

public function jsonSerialize(): mixed {
return [
'id' => $this->id,
'name' => $this->name,
'id' => $this->id,
'name' => $this->name,
];
}
}
Expand Down
34 changes: 17 additions & 17 deletions samples/server/petstore/php-flight/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
Expand Down Expand Up @@ -128,27 +128,27 @@ public function __construct(?int $id, ?string $username, ?string $firstName, ?st
public static function fromArray(array $data): self
{
return new self(
$data['id'] ?? null,
$data['username'] ?? null,
$data['firstName'] ?? null,
$data['lastName'] ?? null,
$data['email'] ?? null,
$data['password'] ?? null,
$data['phone'] ?? null,
$data['userStatus'] ?? null,
$data['id'] ?? null,
$data['username'] ?? null,
$data['firstName'] ?? null,
$data['lastName'] ?? null,
$data['email'] ?? null,
$data['password'] ?? null,
$data['phone'] ?? null,
$data['userStatus'] ?? null,
);
}

public function jsonSerialize(): mixed {
return [
'id' => $this->id,
'username' => $this->username,
'firstName' => $this->firstName,
'lastName' => $this->lastName,
'email' => $this->email,
'password' => $this->password,
'phone' => $this->phone,
'userStatus' => $this->userStatus,
'id' => $this->id,
'username' => $this->username,
'firstName' => $this->firstName,
'lastName' => $this->lastName,
'email' => $this->email,
'password' => $this->password,
'phone' => $this->phone,
'userStatus' => $this->userStatus,
];
}
}
Expand Down
Loading
Loading