Skip to content

Commit 8cd36ae

Browse files
committed
start talking about async
1 parent c4df6c6 commit 8cd36ae

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

docs/sdks/languages/php/oss-comparison-php.mdx

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{/* TODO
2-
3-
- does not handle any polymorphism whatsoever, no allof or anyOf
4-
5-
- se allows configure namespaces if you want. makes a git repo if you want.
6-
- og gives you... travis ci lol
7-
8-
- se provides asynchronous versions of each HTTP call, such as `getStation` and `getStationAsync`.
9-
- OpenAPI Generator provides asynchronous versions of each HTTP call, such as `AddPet` and `AddPetAsync`.
10-
2+
- OG does not handle any polymorphism whatsoever, no allof or anyOf
113
*/}
124

135
import { Table } from "@/mdx/components";
@@ -28,7 +20,7 @@ Here's the high-level summary of the differences between Speakeasy and OpenAPI G
2820
]}
2921
data={[
3022
{ feature: "OpenAPI 3.2 support", speakeasy: "", openapi: "" },
31-
{ feature: "OpenAPI 3.1 support", speakeasy: "", openapi: "🚧" },
23+
{ feature: "OpenAPI 3.1 support", speakeasy: "", openapi: "⚠️ Beta" },
3224
{ feature: "PHP version support", speakeasy: "PHP >=8.2", openapi: "PHP >=8.1" },
3325
{ feature: "Laravel integration", speakeasy: "", openapi: "" },
3426
{ feature: "Type safety", speakeasy: "", openapi: "" },
@@ -626,7 +618,7 @@ At the time of compiling this comparison, the Speakeasy SDK required at least PH
626618

627619
Seeing as PHP 8.1 has stopped receiving security updates we recommend updating to use the latest PHP version regardless of the SDK being used, but when the SDK is being used by external customers it's important to consider the lowest PHP version supported.
628620

629-
## Strict typing
621+
## Type system
630622

631623
Both tools create DocBlocks to provide type annotations to all parameters and variables in the SDKs, which is useful for IDEs and for programmers to understand the code.
632624

@@ -730,28 +722,6 @@ class BookingPayment implements ModelInterface, ArrayAccess, \JsonSerializable
730722

731723
You can see how much more verbose and complex the OpenAPI Generator code is compared to Speakeasy's use of enums.
732724

733-
### Content types
734-
735-
Below are the content types in the schema for creating a booking, in JSON, XML, or as a form.
736-
737-
```yaml
738-
requestBody:
739-
content:
740-
application/json:
741-
schema:
742-
$ref: "#/components/schemas/Booking"
743-
application/xml:
744-
schema:
745-
$ref: "#/components/schemas/Booking"
746-
application/x-www-form-urlencoded:
747-
schema:
748-
$ref: "#/components/schemas/Booking"
749-
```
750-
751-
Speakeasy supports JSON and form content types, but not XML. OpenAPI Generator supports all three.
752-
753-
In Speakeasy, each content type for each operation will become its own file in the SDK. In OpenAPI Generator, all operations are combined into one API file.
754-
755725
### Unions
756726

757727
In OpenAPI, you can use `oneOf` in a schema like this:
@@ -785,6 +755,35 @@ class User
785755

786756
OpenAPI Generator can handle this schema, but creates a 380-line file called `UserAge.php` with custom code to implement unions.
787757

758+
## Asynchronous calls
759+
760+
Both Speakeasy and OpenAPI Generator support asynchronous HTTP calls, but they implement them differently.
761+
762+
Speakeasy: `getStation` and `getStationAsync`.
763+
OpenAPI Generator `AddPet` and `AddPetAsync`.
764+
765+
## Content types
766+
767+
Below are the content types in the schema for creating a booking, in JSON, XML, or as a form.
768+
769+
```yaml
770+
requestBody:
771+
content:
772+
application/json:
773+
schema:
774+
$ref: "#/components/schemas/Booking"
775+
application/xml:
776+
schema:
777+
$ref: "#/components/schemas/Booking"
778+
application/x-www-form-urlencoded:
779+
schema:
780+
$ref: "#/components/schemas/Booking"
781+
```
782+
783+
Speakeasy supports JSON and form content types, but not XML. OpenAPI Generator supports all three.
784+
785+
In Speakeasy, each content type for each operation will become its own file in the SDK. In OpenAPI Generator, all operations are combined into one API file.
786+
788787
## Created documentation
789788

790789
Both Speakeasy and OpenAPI Generator create a `docs` directory with Markdown documentation and PHP usage examples for every operation and every model. Unfortunately despite the formatting not looking to great to the eye of the beholder, there are two syntax errors in here which will need to be fixed before trying to run this code. Can you spot them?

0 commit comments

Comments
 (0)