Skip to content

Commit 2a9ac81

Browse files
authored
Merge branch 'OpenAPITools:master' into master
2 parents ad36012 + 165465a commit 2a9ac81

393 files changed

Lines changed: 6176 additions & 7681 deletions

File tree

Some content is hidden

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

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
251251
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
252252

253253
if (schema.getDefault() != null) { // array schema has default value
254-
return "[" + schema.getDefault().toString() + "]";
254+
return schema.getDefault().toString();
255255
} else if (schema.getItems().getDefault() != null) { // array item schema has default value
256256
return "[" + toDefaultValue(schema.getItems()) + "]";
257257
} else {

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public CodegenModel fromModel(String name, Schema model) {
300300
// If the type is an array, extend the name with the inner type to prevent name collisions
301301
// in case multiple arrays with different types are defined. If the user has manually specified
302302
// a name, use that name instead.
303-
String collectionWithTypeName = toModelName(schema.getType()) + oneOf.containerTypeMapped + oneOf.items.dataType;
303+
String collectionWithTypeName = toModelName(schema.getType()) + oneOf.containerTypeMapped + oneOf.items.baseType;
304304
String oneOfName = Optional.ofNullable(schema.getTitle()).orElse(collectionWithTypeName);
305305
oneOf.setName(oneOfName);
306306
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttp4sClientCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ public void processOpts() {
274274
if (!excludeSbt) {
275275
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
276276
supportingFiles.add(new SupportingFile("project/build.properties.mustache", "project", "build.properties"));
277+
supportingFiles.add(new SupportingFile("project/plugins.mustache", "project", "plugins.sbt"));
278+
supportingFiles.add(new SupportingFile("scalafmt.mustache", "", ".scalafmt.conf"));
277279
} else {
278280
supportingFiles.remove(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
279281
supportingFiles.remove(new SupportingFile("project/build.properties.mustache", "project", "build.properties"));

modules/openapi-generator/src/main/resources/php-nextgen/Configuration.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ class Configuration
492492
}
493493

494494
/**
495-
* Returns URL based on host settings, index and variables
496-
*
497-
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
498-
* @param int $hostIndex index of the host settings
499-
* @param array|null $variables hash of variable and the corresponding value (optional)
500-
* @return string URL based on host settings
501-
*/
495+
* Returns URL based on host settings, index and variables
496+
*
497+
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
498+
* @param int $hostIndex index of the host settings
499+
* @param array|null $variables hash of variable and the corresponding value (optional)
500+
* @return string URL based on host settings
501+
*/
502502
public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
503503
{
504504
if (null === $variables) {

modules/openapi-generator/src/main/resources/php-nextgen/HeaderSelector.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ class HeaderSelector
8686
}
8787

8888
/**
89-
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
90-
*
91-
* @param string[] $accept Array of Accept Headers
92-
* @param string[] $headersWithJson Array of Accept Headers of type "json"
93-
*
94-
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
95-
*/
89+
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
90+
*
91+
* @param string[] $accept Array of Accept Headers
92+
* @param string[] $headersWithJson Array of Accept Headers of type "json"
93+
*
94+
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
95+
*/
9696
private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
9797
{
9898
$processedHeaders = [

modules/openapi-generator/src/main/resources/php-nextgen/ModelInterface.mustache

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,50 +37,51 @@ interface ModelInterface
3737
/**
3838
* Array of property to type mappings. Used for (de)serialization
3939
*
40-
* @return array
40+
* @return array<string,string>
4141
*/
4242
public static function openAPITypes(): array;
4343
4444
/**
4545
* Array of property to format mappings. Used for (de)serialization
4646
*
47-
* @return array
47+
* @return array<string,string|null>
4848
*/
4949
public static function openAPIFormats(): array;
5050
5151
/**
52-
* Array of attributes where the key is the local name, and the value is the original name
52+
* Array of attributes where the key is the local name,
53+
* and the value is the original name
5354
*
54-
* @return array
55+
* @return array<string,string>
5556
*/
5657
public static function attributeMap(): array;
5758
5859
/**
5960
* Array of attributes to setter functions (for deserialization of responses)
6061
*
61-
* @return array
62+
* @return array<string,string>
6263
*/
6364
public static function setters(): array;
6465
6566
/**
6667
* Array of attributes to getter functions (for serialization of requests)
6768
*
68-
* @return array
69+
* @return array<string,string>
6970
*/
7071
public static function getters(): array;
7172
7273
/**
7374
* Show all the invalid properties with reasons.
7475
*
75-
* @return array
76+
* @return string[] invalid properties with reasons
7677
*/
7778
public function listInvalidProperties(): array;
7879
7980
/**
8081
* Validate all the properties in the model
8182
* return true if all passed
8283
*
83-
* @return bool
84+
* @return bool True if all properties are valid
8485
*/
8586
public function valid(): bool;
8687

modules/openapi-generator/src/main/resources/php-nextgen/api.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,15 @@ use {{invokerPackage}}\ObjectSerializer;
569569
{{/exts.x-group-parameters}}
570570
{{#servers}}
571571
{{#-first}}
572-
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
573-
* if needed, use the 'variables' parameter to pass variables to the host.
572+
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
573+
* if needed, use the 'variables' parameter to pass variables to the host.
574574
{{/-first}}
575575
* URL: {{{url}}}
576576
{{#variables}}
577577
{{#-first}}
578578
* Variables:
579579
{{/-first}}
580-
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
580+
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
581581
{{#-first}}
582582
* Allowed values:
583583
{{/-first}}

modules/openapi-generator/src/main/resources/php-nextgen/model_doc.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{#models}}{{#model}}# {{classname}}
1+
{{#models}}{{#model}}# {{classname}}
22

33
## Properties
44

modules/openapi-generator/src/main/resources/php-nextgen/model_enum.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ enum {{classname}}: {{exts.x-php-enum-type}}
44
{{#enumVars}}
55
{{#enumDescription}}
66
/**
7-
* {{enumDescription}}
8-
*/
7+
* {{enumDescription}}
8+
*/
99
{{/enumDescription}}
1010
case {{{name}}} = {{{value}}};
1111
{{^-last}}

modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,59 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
33
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
44

55
/**
6-
* The original name of the model.
7-
*
8-
* @var string
9-
*/
6+
* The original name of the model.
7+
*
8+
* @var string
9+
*/
1010
protected static string $openAPIModelName = '{{name}}';
1111

1212
/**
13-
* Array of property to type mappings. Used for (de)serialization
14-
*
15-
* @var array<string, string>
16-
*/
13+
* Array of property to type mappings. Used for (de)serialization
14+
*
15+
* @var array<string, string>
16+
*/
1717
protected static array $openAPITypes = [
1818
{{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}},
1919
{{/-last}}{{/vars}}
2020
];
2121

2222
/**
23-
* Array of property to format mappings. Used for (de)serialization
24-
*
25-
* @var array<string, string|null>
26-
*/
23+
* Array of property to format mappings. Used for (de)serialization
24+
*
25+
* @var array<string, string|null>
26+
*/
2727
protected static array $openAPIFormats = [
2828
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}},
2929
{{/-last}}{{/vars}}
3030
];
3131

3232
/**
33-
* Array of nullable properties. Used for (de)serialization
34-
*
35-
* @var array<string, bool>
36-
*/
33+
* Array of nullable properties. Used for (de)serialization
34+
*
35+
* @var array<string, bool>
36+
*/
3737
protected static array $openAPINullables = [
3838
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
3939
{{/-last}}{{/vars}}
4040
];
4141

4242
/**
43-
* If a nullable field gets set to null, insert it here
44-
*
45-
* @var array<string, bool>
46-
*/
43+
* If a nullable field gets set to null, insert it here
44+
*
45+
* @var array<string, bool>
46+
*/
4747
protected array $openAPINullablesSetToNull = [];
4848

4949
/**
50-
* Array of property to type mappings. Used for (de)serialization
51-
*
52-
* @return array<string, string>
50+
* {@inheritdoc}
5351
*/
5452
public static function openAPITypes(): array
5553
{
5654
return self::$openAPITypes{{#parentSchema}} + parent::openAPITypes(){{/parentSchema}};
5755
}
5856

5957
/**
60-
* Array of property to format mappings. Used for (de)serialization
61-
*
62-
* @return array<string, string>
58+
* {@inheritdoc}
6359
*/
6460
public static function openAPIFormats(): array
6561
{
@@ -97,21 +93,15 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
9793
}
9894

9995
/**
100-
* Checks if a property is nullable
101-
*
102-
* @param string $property
103-
* @return bool
96+
* {@inheritdoc}
10497
*/
10598
public static function isNullable(string $property): bool
10699
{
107100
return self::openAPINullables()[$property] ?? false;
108101
}
109102

110103
/**
111-
* Checks if a nullable property is set to null.
112-
*
113-
* @param string $property
114-
* @return bool
104+
* {@inheritdoc}
115105
*/
116106
public function isNullableSetToNull(string $property): bool
117107
{
@@ -150,40 +140,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
150140
];
151141

152142
/**
153-
* Array of attributes where the key is the local name,
154-
* and the value is the original name
155-
*
156-
* @return array<string, string>
143+
* {@inheritdoc}
157144
*/
158145
public static function attributeMap(): array
159146
{
160147
return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap;
161148
}
162149

163150
/**
164-
* Array of attributes to setter functions (for deserialization of responses)
165-
*
166-
* @return array<string, string>
151+
* {@inheritdoc}
167152
*/
168153
public static function setters(): array
169154
{
170155
return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters;
171156
}
172157

173158
/**
174-
* Array of attributes to getter functions (for serialization of requests)
175-
*
176-
* @return array<string, string>
159+
* {@inheritdoc}
177160
*/
178161
public static function getters(): array
179162
{
180163
return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters;
181164
}
182165

183166
/**
184-
* The original name of the model.
185-
*
186-
* @return string
167+
* {@inheritdoc}
187168
*/
188169
public function getModelName(): string
189170
{
@@ -262,14 +243,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
262243
}
263244

264245
/**
265-
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
266-
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
267-
* $this->openAPINullablesSetToNull array
268-
*
269-
* @param string $variableName
270-
* @param array $fields
271-
* @param mixed $defaultValue
272-
*/
246+
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
247+
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
248+
* $this->openAPINullablesSetToNull array
249+
*
250+
* @param string $variableName
251+
* @param array $fields
252+
* @param mixed $defaultValue
253+
*/
273254
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
274255
{
275256
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
@@ -280,9 +261,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
280261
}
281262

282263
/**
283-
* Show all the invalid properties with reasons.
284-
*
285-
* @return string[] invalid properties with reasons
264+
* {@inheritdoc}
286265
*/
287266
public function listInvalidProperties(): array
288267
{
@@ -361,10 +340,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
361340
}
362341

363342
/**
364-
* Validate all the properties in the model
365-
* return true if all passed
366-
*
367-
* @return bool True if all properties are valid
343+
* {@inheritdoc}
368344
*/
369345
public function valid(): bool
370346
{

0 commit comments

Comments
 (0)