Skip to content

Commit 2217a7b

Browse files
authored
feat: simple/experimental generator for flight-php server framework (#18406)
* feat: simple/experimental generator for flight-php server framework * fix: update php-flight samples and add php-flight to integration tests * feat: adding path to method doc
1 parent 6568bc5 commit 2217a7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3439
-0
lines changed

.github/workflows/samples-php8.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
paths:
66
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
7+
- samples/server/petstore/php-flight/**
78
pull_request:
89
paths:
910
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
11+
- samples/server/petstore/php-flight/**
1012
jobs:
1113
build:
1214
name: Build PHP projects
@@ -17,6 +19,7 @@ jobs:
1719
sample:
1820
# servers
1921
- samples/server/petstore/php-symfony/SymfonyBundle-php/
22+
- samples/server/petstore/php-flight/
2023
steps:
2124
- uses: actions/checkout@v4
2225
- name: Setup PHP with tools

bin/configs/php-flight.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: php-flight
2+
outputDir: samples/server/petstore/php-flight
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/php-flight
5+
additionalProperties:
6+
hideGenerationTimestamp: "true"

docs/generators.md

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ The following generators are available:
120120
* [kotlin-spring](generators/kotlin-spring.md)
121121
* [kotlin-vertx (beta)](generators/kotlin-vertx.md)
122122
* [nodejs-express-server (beta)](generators/nodejs-express-server.md)
123+
* [php-flight (experimental)](generators/php-flight.md)
123124
* [php-laravel](generators/php-laravel.md)
124125
* [php-lumen](generators/php-lumen.md)
125126
* [php-mezzio-ph](generators/php-mezzio-ph.md)

docs/generators/php-flight.md

+270
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
---
2+
title: Documentation for the php-flight Generator
3+
---
4+
5+
## METADATA
6+
7+
| Property | Value | Notes |
8+
| -------- | ----- | ----- |
9+
| generator name | php-flight | pass this to the generate command after -g |
10+
| generator stability | EXPERIMENTAL | |
11+
| generator type | SERVER | |
12+
| generator language | PHP | |
13+
| generator default templating engine | mustache | |
14+
| helpTxt | Generates a PHP Flight Framework server library. | |
15+
16+
## CONFIG OPTIONS
17+
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
18+
19+
| Option | Description | Values | Default |
20+
| ------ | ----------- | ------ | ------- |
21+
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
22+
|apiPackage|package for generated api classes| |null|
23+
|artifactUrl|artifact URL in generated pom.xml| |null|
24+
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
25+
|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null|
26+
|developerOrganization|developer organization in generated pom.xml| |null|
27+
|developerOrganizationUrl|developer organization URL in generated pom.xml| |null|
28+
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
29+
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
30+
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
31+
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
32+
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
33+
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
34+
|licenseName|The name of the license| |null|
35+
|modelPackage|package for generated models| |null|
36+
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
37+
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
38+
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
39+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
40+
|srcBasePath|The directory to serve as source root.| |null|
41+
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |camelCase|
42+
43+
## IMPORT MAPPING
44+
45+
| Type/Alias | Imports |
46+
| ---------- | ------- |
47+
48+
49+
## INSTANTIATION TYPES
50+
51+
| Type/Alias | Instantiated By |
52+
| ---------- | --------------- |
53+
|array|array|
54+
|map|array|
55+
56+
57+
## LANGUAGE PRIMITIVES
58+
59+
<ul class="column-ul">
60+
<li>\DateTime</li>
61+
<li>\SplFileObject</li>
62+
<li>array</li>
63+
<li>bool</li>
64+
<li>boolean</li>
65+
<li>byte</li>
66+
<li>float</li>
67+
<li>int</li>
68+
<li>integer</li>
69+
<li>mixed</li>
70+
<li>number</li>
71+
<li>object</li>
72+
<li>string</li>
73+
<li>void</li>
74+
</ul>
75+
76+
## RESERVED WORDS
77+
78+
<ul class="column-ul">
79+
<li>__halt_compiler</li>
80+
<li>_header_accept</li>
81+
<li>_tempbody</li>
82+
<li>abstract</li>
83+
<li>and</li>
84+
<li>array</li>
85+
<li>as</li>
86+
<li>break</li>
87+
<li>callable</li>
88+
<li>case</li>
89+
<li>catch</li>
90+
<li>class</li>
91+
<li>clone</li>
92+
<li>const</li>
93+
<li>continue</li>
94+
<li>declare</li>
95+
<li>default</li>
96+
<li>die</li>
97+
<li>do</li>
98+
<li>echo</li>
99+
<li>else</li>
100+
<li>elseif</li>
101+
<li>empty</li>
102+
<li>enddeclare</li>
103+
<li>endfor</li>
104+
<li>endforeach</li>
105+
<li>endif</li>
106+
<li>endswitch</li>
107+
<li>endwhile</li>
108+
<li>eval</li>
109+
<li>exit</li>
110+
<li>extends</li>
111+
<li>final</li>
112+
<li>for</li>
113+
<li>foreach</li>
114+
<li>formparams</li>
115+
<li>function</li>
116+
<li>global</li>
117+
<li>goto</li>
118+
<li>headerparams</li>
119+
<li>httpbody</li>
120+
<li>if</li>
121+
<li>implements</li>
122+
<li>include</li>
123+
<li>include_once</li>
124+
<li>instanceof</li>
125+
<li>insteadof</li>
126+
<li>interface</li>
127+
<li>isset</li>
128+
<li>list</li>
129+
<li>namespace</li>
130+
<li>new</li>
131+
<li>or</li>
132+
<li>print</li>
133+
<li>private</li>
134+
<li>protected</li>
135+
<li>public</li>
136+
<li>queryparams</li>
137+
<li>require</li>
138+
<li>require_once</li>
139+
<li>resourcepath</li>
140+
<li>return</li>
141+
<li>static</li>
142+
<li>switch</li>
143+
<li>throw</li>
144+
<li>trait</li>
145+
<li>try</li>
146+
<li>unset</li>
147+
<li>use</li>
148+
<li>var</li>
149+
<li>while</li>
150+
<li>xor</li>
151+
</ul>
152+
153+
## FEATURE SET
154+
155+
156+
### Client Modification Feature
157+
| Name | Supported | Defined By |
158+
| ---- | --------- | ---------- |
159+
|BasePath|✗|ToolingExtension
160+
|Authorizations|✗|ToolingExtension
161+
|UserAgent|✗|ToolingExtension
162+
|MockServer|✗|ToolingExtension
163+
164+
### Data Type Feature
165+
| Name | Supported | Defined By |
166+
| ---- | --------- | ---------- |
167+
|Custom|✗|OAS2,OAS3
168+
|Int32|✓|OAS2,OAS3
169+
|Int64|✓|OAS2,OAS3
170+
|Float|✓|OAS2,OAS3
171+
|Double|✓|OAS2,OAS3
172+
|Decimal|✓|ToolingExtension
173+
|String|✓|OAS2,OAS3
174+
|Byte|✓|OAS2,OAS3
175+
|Binary|✓|OAS2,OAS3
176+
|Boolean|✓|OAS2,OAS3
177+
|Date|✓|OAS2,OAS3
178+
|DateTime|✓|OAS2,OAS3
179+
|Password|✓|OAS2,OAS3
180+
|File|✓|OAS2
181+
|Uuid||
182+
|Array|✓|OAS2,OAS3
183+
|Null|✗|OAS3
184+
|AnyType|✗|OAS2,OAS3
185+
|Object|✓|OAS2,OAS3
186+
|Maps|✓|ToolingExtension
187+
|CollectionFormat|✓|OAS2
188+
|CollectionFormatMulti|✓|OAS2
189+
|Enum|✓|OAS2,OAS3
190+
|ArrayOfEnum|✓|ToolingExtension
191+
|ArrayOfModel|✓|ToolingExtension
192+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
193+
|ArrayOfCollectionOfModel|✓|ToolingExtension
194+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
195+
|MapOfEnum|✗|ToolingExtension
196+
|MapOfModel|✗|ToolingExtension
197+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
198+
|MapOfCollectionOfModel|✗|ToolingExtension
199+
|MapOfCollectionOfEnum|✗|ToolingExtension
200+
201+
### Documentation Feature
202+
| Name | Supported | Defined By |
203+
| ---- | --------- | ---------- |
204+
|Readme|✓|ToolingExtension
205+
|Model|✓|ToolingExtension
206+
|Api|✓|ToolingExtension
207+
208+
### Global Feature
209+
| Name | Supported | Defined By |
210+
| ---- | --------- | ---------- |
211+
|Host|✓|OAS2,OAS3
212+
|BasePath|✓|OAS2,OAS3
213+
|Info|✓|OAS2,OAS3
214+
|Schemes|✗|OAS2,OAS3
215+
|PartialSchemes|✓|OAS2,OAS3
216+
|Consumes|✓|OAS2
217+
|Produces|✓|OAS2
218+
|ExternalDocumentation|✓|OAS2,OAS3
219+
|Examples|✓|OAS2,OAS3
220+
|XMLStructureDefinitions|✗|OAS2,OAS3
221+
|MultiServer|✗|OAS3
222+
|ParameterizedServer|✗|OAS3
223+
|ParameterStyling|✗|OAS3
224+
|Callbacks|✗|OAS3
225+
|LinkObjects|✗|OAS3
226+
227+
### Parameter Feature
228+
| Name | Supported | Defined By |
229+
| ---- | --------- | ---------- |
230+
|Path|✓|OAS2,OAS3
231+
|Query|✓|OAS2,OAS3
232+
|Header|✓|OAS2,OAS3
233+
|Body|✓|OAS2
234+
|FormUnencoded|✗|OAS2
235+
|FormMultipart|✗|OAS2
236+
|Cookie|✗|OAS3
237+
238+
### Schema Support Feature
239+
| Name | Supported | Defined By |
240+
| ---- | --------- | ---------- |
241+
|Simple|✓|OAS2,OAS3
242+
|Composite|✓|OAS2,OAS3
243+
|Polymorphism|✗|OAS2,OAS3
244+
|Union|✗|OAS3
245+
|allOf|✗|OAS2,OAS3
246+
|anyOf|✗|OAS3
247+
|oneOf|✗|OAS3
248+
|not|✗|OAS3
249+
250+
### Security Feature
251+
| Name | Supported | Defined By |
252+
| ---- | --------- | ---------- |
253+
|BasicAuth|✓|OAS2,OAS3
254+
|ApiKey|✓|OAS2,OAS3
255+
|OpenIDConnect|✗|OAS3
256+
|BearerToken|✓|OAS3
257+
|OAuth2_Implicit|✓|OAS2,OAS3
258+
|OAuth2_Password|✗|OAS2,OAS3
259+
|OAuth2_ClientCredentials|✗|OAS2,OAS3
260+
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
261+
|SignatureAuth|✗|OAS3
262+
|AWSV4Signature|✗|ToolingExtension
263+
264+
### Wire Format Feature
265+
| Name | Supported | Defined By |
266+
| ---- | --------- | ---------- |
267+
|JSON|✓|OAS2,OAS3
268+
|XML|✗|OAS2,OAS3
269+
|PROTOBUF|✗|ToolingExtension
270+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)