|3.0.0|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useDefaultRouting|Use default routing for the ASP.NET Core version.| |true|
|useFrameworkReference|Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.| |false|
|useNewtonsoft|Uses the Newtonsoft JSON library.| |true|
+|useSeperateModelProject|Create a seperate project for models| |false|
|useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |true|
## IMPORT MAPPING
diff --git a/docs/generators/cpp-pistache-server.md b/docs/generators/cpp-pistache-server.md
index 708e09aebf4..5730d711ab1 100644
--- a/docs/generators/cpp-pistache-server.md
+++ b/docs/generators/cpp-pistache-server.md
@@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports |
| ---------- | ------- |
|Object|#include "Object.h"|
+|nlohmann::json|#include <nlohmann/json.hpp>|
|std::map|#include <map>|
|std::string|#include <string>|
|std::vector|#include <vector>|
diff --git a/docs/generators/cpp-restbed-server-deprecated.md b/docs/generators/cpp-restbed-server-deprecated.md
new file mode 100644
index 00000000000..13f7b83d31f
--- /dev/null
+++ b/docs/generators/cpp-restbed-server-deprecated.md
@@ -0,0 +1,265 @@
+---
+title: Documentation for the cpp-restbed-server-deprecated Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | cpp-restbed-server-deprecated | pass this to the generate command after -g |
+| generator stability | STABLE | |
+| generator type | SERVER | |
+| generator language | C++ | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a C++ API Server with Restbed (https://github.com/Corvusoft/restbed). | |
+
+## CONFIG OPTIONS
+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.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|apiPackage|C++ namespace for apis (convention: name.space.api).| |org.openapitools.server.api|
+|declspec|C++ preprocessor to place before the class name for handling dllexport/dllimport.| ||
+|defaultInclude|The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" | ||
+|modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.server.model|
+|packageVersion|C++ package version.| |1.0.0|
+|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+|Object|#include "Object.h"|
+|restbed::Bytes|#include <corvusoft/restbed/byte.hpp>|
+|std::map|#include <map>|
+|std::string|#include <string>|
+|std::vector|#include <vector>|
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+
+
+## LANGUAGE PRIMITIVES
+
+
+
bool
+
char
+
double
+
float
+
int
+
int32_t
+
int64_t
+
long
+
+
+## RESERVED WORDS
+
+
+
alignas
+
alignof
+
and
+
and_eq
+
asm
+
auto
+
bitand
+
bitor
+
bool
+
break
+
case
+
catch
+
char
+
char16_t
+
char32_t
+
class
+
compl
+
concept
+
const
+
const_cast
+
constexpr
+
continue
+
decltype
+
default
+
delete
+
do
+
double
+
dynamic_cast
+
else
+
enum
+
explicit
+
export
+
extern
+
false
+
float
+
for
+
friend
+
goto
+
if
+
inline
+
int
+
linux
+
long
+
mutable
+
namespace
+
new
+
noexcept
+
not
+
not_eq
+
nullptr
+
operator
+
or
+
or_eq
+
private
+
protected
+
public
+
register
+
reinterpret_cast
+
requires
+
return
+
short
+
signed
+
sizeof
+
static
+
static_assert
+
static_cast
+
struct
+
switch
+
template
+
this
+
thread_local
+
throw
+
true
+
try
+
typedef
+
typeid
+
typename
+
union
+
unsigned
+
using
+
virtual
+
void
+
volatile
+
wchar_t
+
while
+
xor
+
xor_eq
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✗|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✗|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✗|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✗|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✗|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✗|OAS2,OAS3
+|ApiKey|✗|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✗|OAS3
+|OAuth2_Implicit|✗|OAS2,OAS3
+|OAuth2_Password|✗|OAS2,OAS3
+|OAuth2_ClientCredentials|✗|OAS2,OAS3
+|OAuth2_AuthorizationCode|✗|OAS2,OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/docs/generators/cpp-restbed-server.md b/docs/generators/cpp-restbed-server.md
index f376b503cc7..a0450db79dd 100644
--- a/docs/generators/cpp-restbed-server.md
+++ b/docs/generators/cpp-restbed-server.md
@@ -29,9 +29,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports |
| ---------- | ------- |
-|Object|#include "Object.h"|
+|file|#include <string>|
|restbed::Bytes|#include <corvusoft/restbed/byte.hpp>|
|std::map|#include <map>|
+|std::set|#include <set>|
|std::string|#include <string>|
|std::vector|#include <vector>|
diff --git a/docs/generators/crystal.md b/docs/generators/crystal.md
index 6d4341efa07..1f3bc4a655f 100644
--- a/docs/generators/crystal.md
+++ b/docs/generators/crystal.md
@@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
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.
|true|
+|moduleName|module name (e.g. TwitterClient| |OpenAPIClient|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|shardAuthor|shard author (only one is supported).| |null|
|shardAuthorEmail|shard author email (only one is supported).| |null|
diff --git a/docs/generators/csharp-netcore.md b/docs/generators/csharp-netcore.md
index 1e88fb7ac4d..481ffa3fee6 100644
--- a/docs/generators/csharp-netcore.md
+++ b/docs/generators/csharp-netcore.md
@@ -42,7 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|sourceFolder|source folder for generated code| |src|
-|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net5.0**
.NET 5.0 compatible
**net6.0**
.NET 6.0 compatible
|netstandard2.0|
+|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net48**
.NET Framework 4.8 compatible
**net5.0**
.NET 5.0 compatible
**net6.0**
.NET 6.0 compatible
|netstandard2.0|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
@@ -307,7 +307,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
-|OAuth2_ClientCredentials|✗|OAS2,OAS3
+|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md
new file mode 100644
index 00000000000..13b1af6a314
--- /dev/null
+++ b/docs/generators/java-helidon-client.md
@@ -0,0 +1,316 @@
+---
+title: Documentation for the java-helidon-client Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | java-helidon-client | pass this to the generate command after -g |
+| generator stability | BETA | |
+| generator type | CLIENT | |
+| generator language | Java | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a Helidon MP or SE client | |
+
+## CONFIG OPTIONS
+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.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
+|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
+|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|apiPackage|package for generated api classes| |org.openapitools.client.api|
+|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
+|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client|
+|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
+|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
+|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
+|booleanGetterPrefix|Set booleanGetterPrefix| |get|
+|configKey|Config key in @RegisterRestClient. Default to none.| |null|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8|
+|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
+|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
+|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false|
+|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
+|fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| ||
+|groupId|groupId in generated pom.xml| |org.openapitools|
+|helidonVersion|Helidon version for generated code| |3.0.1|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
+|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
+|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
+|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
+|invokerPackage|root package for generated code| |org.openapitools.client|
+|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
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.
|true|
+|library|library template (sub-template) to use|
**mp**
Helidon MP Client
**se**
Helidon SE Client
|mp|
+|licenseName|The name of the license| |Unlicense|
+|licenseUrl|The URL of the license| |http://unlicense.org|
+|modelPackage|package for generated models| |org.openapitools.client.model|
+|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
+|rootJavaEEPackage|Root package name for Java EE| |Helidon 2.x and earlier: javax; Helidon 3.x and later: jakarta|
+|serializableModel|boolean - toggle "implements Serializable" for generated models| |false|
+|serializationLibrary|Serialization library, defaults to Jackson|
**jsonb**
Use JSON-B as serialization library
**jackson**
Use Jackson as serialization library
|null|
+|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null|
+|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
+|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+|sourceFolder|source folder for generated code| |src/main/java|
+|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
+|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
+
+## SUPPORTED VENDOR EXTENSIONS
+
+| Extension name | Description | Applicable for | Default value |
+| -------------- | ----------- | -------------- | ------------- |
+|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
+|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array
+|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value
+|x-tags|Specify multiple swagger tags for operation|OPERATION|null
+|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
+|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
+|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
+|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
+|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono/Flux` or `return T/List/Set` & execute `.block()` inside generated method)|OPERATION|false
+
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+|Array|java.util.List|
+|ArrayList|java.util.ArrayList|
+|BigDecimal|java.math.BigDecimal|
+|Date|java.util.Date|
+|DateTime|org.joda.time.*|
+|File|java.io.File|
+|HashMap|java.util.HashMap|
+|LinkedHashSet|java.util.LinkedHashSet|
+|List|java.util.*|
+|LocalDate|org.joda.time.*|
+|LocalDateTime|org.joda.time.*|
+|LocalTime|org.joda.time.*|
+|Map|java.util.Map|
+|Set|java.util.*|
+|Timestamp|java.sql.Timestamp|
+|URI|java.net.URI|
+|UUID|java.util.UUID|
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+|array|ArrayList|
+|map|HashMap|
+|set|LinkedHashSet|
+
+
+## LANGUAGE PRIMITIVES
+
+
+
Boolean
+
Double
+
Float
+
Integer
+
Long
+
Object
+
String
+
boolean
+
byte[]
+
+
+## RESERVED WORDS
+
+
+
abstract
+
apiclient
+
apiexception
+
apiresponse
+
assert
+
boolean
+
break
+
byte
+
case
+
catch
+
char
+
class
+
configuration
+
const
+
continue
+
default
+
do
+
double
+
else
+
enum
+
extends
+
file
+
final
+
finally
+
float
+
for
+
goto
+
if
+
implements
+
import
+
instanceof
+
int
+
interface
+
list
+
localreturntype
+
localvaraccept
+
localvaraccepts
+
localvarauthnames
+
localvarcollectionqueryparams
+
localvarcontenttype
+
localvarcontenttypes
+
localvarcookieparams
+
localvarformparams
+
localvarheaderparams
+
localvarpath
+
localvarpostbody
+
localvarqueryparams
+
long
+
native
+
new
+
null
+
object
+
package
+
private
+
protected
+
public
+
return
+
short
+
static
+
strictfp
+
stringutil
+
super
+
switch
+
synchronized
+
this
+
throw
+
throws
+
transient
+
try
+
void
+
volatile
+
while
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✓|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✓|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✗|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✓|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✗|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✗|OAS2,OAS3
+|ApiKey|✗|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✗|OAS3
+|OAuth2_Implicit|✗|OAS2,OAS3
+|OAuth2_Password|✗|OAS2,OAS3
+|OAuth2_ClientCredentials|✗|OAS2,OAS3
+|OAuth2_AuthorizationCode|✗|OAS2,OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md
new file mode 100644
index 00000000000..a33de1eb380
--- /dev/null
+++ b/docs/generators/java-helidon-server.md
@@ -0,0 +1,318 @@
+---
+title: Documentation for the java-helidon-server Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | java-helidon-server | pass this to the generate command after -g |
+| generator stability | BETA | |
+| generator type | SERVER | |
+| generator language | Java | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a Java Helidon Server application. | |
+
+## CONFIG OPTIONS
+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.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
+|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
+|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|apiPackage|package for generated api classes| |org.openapitools.server.api|
+|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
+|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-server|
+|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
+|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
+|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
+|booleanGetterPrefix|Set booleanGetterPrefix| |get|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+)
|java8|
+|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
+|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
+|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false|
+|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
+|fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| ||
+|gradleProject|Whether to generate gradle project instead of maven.| |false|
+|groupId|groupId in generated pom.xml| |org.openapitools|
+|helidonVersion|Helidon version for generated code| |3.0.1|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
+|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
+|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
+|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
+|invokerPackage|root package for generated code| |org.openapitools.server|
+|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
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.
|true|
+|library|library template (sub-template) to use|
**mp**
Helidon MP Server
**se**
Helidon SE Server
**nima**
Helidon NIMA Server
**nima-annotations**
Helidon NIMA Annotations Server
|se|
+|licenseName|The name of the license| |Unlicense|
+|licenseUrl|The URL of the license| |http://unlicense.org|
+|modelPackage|package for generated models| |org.openapitools.server.model|
+|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
+|performBeanValidation|Perform BeanValidation| |false|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
+|rootJavaEEPackage|Root package name for Java EE| |Helidon 2.x and earlier: javax; Helidon 3.x and later: jakarta|
+|serializableModel|boolean - toggle "implements Serializable" for generated models| |false|
+|serializationLibrary|Serialization library, defaults to Jackson|
**jsonb**
Use JSON-B as serialization library
**jackson**
Use Jackson as serialization library
|null|
+|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null|
+|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
+|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+|sourceFolder|source folder for generated code| |src/main/java|
+|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
+|useAbstractClass|Whether to generate abstract classes for REST API instead of interfaces.| |false|
+|useBeanValidation|Use Bean Validation| |false|
+|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
+
+## SUPPORTED VENDOR EXTENSIONS
+
+| Extension name | Description | Applicable for | Default value |
+| -------------- | ----------- | -------------- | ------------- |
+|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
+|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array
+|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value
+|x-tags|Specify multiple swagger tags for operation|OPERATION|null
+|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
+|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
+|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
+|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
+
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+|Array|java.util.List|
+|ArrayList|java.util.ArrayList|
+|BigDecimal|java.math.BigDecimal|
+|Date|java.util.Date|
+|DateTime|org.joda.time.*|
+|File|java.io.File|
+|HashMap|java.util.HashMap|
+|LinkedHashSet|java.util.LinkedHashSet|
+|List|java.util.*|
+|LocalDate|org.joda.time.*|
+|LocalDateTime|org.joda.time.*|
+|LocalTime|org.joda.time.*|
+|Map|java.util.Map|
+|Set|java.util.*|
+|Timestamp|java.sql.Timestamp|
+|URI|java.net.URI|
+|UUID|java.util.UUID|
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+|array|ArrayList|
+|map|HashMap|
+|set|LinkedHashSet|
+
+
+## LANGUAGE PRIMITIVES
+
+
+
Boolean
+
Double
+
Float
+
Integer
+
Long
+
Object
+
String
+
boolean
+
byte[]
+
+
+## RESERVED WORDS
+
+
+
abstract
+
apiclient
+
apiexception
+
apiresponse
+
assert
+
boolean
+
break
+
byte
+
case
+
catch
+
char
+
class
+
configuration
+
const
+
continue
+
default
+
do
+
double
+
else
+
enum
+
extends
+
file
+
final
+
finally
+
float
+
for
+
goto
+
if
+
implements
+
import
+
instanceof
+
int
+
interface
+
list
+
localreturntype
+
localvaraccept
+
localvaraccepts
+
localvarauthnames
+
localvarcollectionqueryparams
+
localvarcontenttype
+
localvarcontenttypes
+
localvarcookieparams
+
localvarformparams
+
localvarheaderparams
+
localvarpath
+
localvarpostbody
+
localvarqueryparams
+
long
+
native
+
new
+
null
+
object
+
package
+
private
+
protected
+
public
+
return
+
short
+
static
+
strictfp
+
stringutil
+
super
+
switch
+
synchronized
+
this
+
throw
+
throws
+
transient
+
try
+
void
+
volatile
+
while
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✓|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✗|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✗|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✓|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✗|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✗|OAS2,OAS3
+|ApiKey|✗|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✗|OAS3
+|OAuth2_Implicit|✗|OAS2,OAS3
+|OAuth2_Password|✗|OAS2,OAS3
+|OAuth2_ClientCredentials|✗|OAS2,OAS3
+|OAuth2_AuthorizationCode|✗|OAS2,OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/docs/generators/javascript-apollo-deprecated.md b/docs/generators/javascript-apollo-deprecated.md
new file mode 100644
index 00000000000..ffc30f726ab
--- /dev/null
+++ b/docs/generators/javascript-apollo-deprecated.md
@@ -0,0 +1,274 @@
+---
+title: Documentation for the javascript-apollo-deprecated Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | javascript-apollo-deprecated | pass this to the generate command after -g |
+| generator stability | DEPRECATED | |
+| generator type | CLIENT | |
+| generator language | Javascript | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a JavaScript client library (beta) using Apollo RESTDatasource. | |
+
+## CONFIG OPTIONS
+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.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|apiPackage|package for generated api classes| |null|
+|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
+|emitJSDoc|generate JSDoc comments| |true|
+|emitModelMethods|generate getters and setters for model properties| |false|
+|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
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.
|true|
+|licenseName|name of the license the project uses (Default: using info.license.name)| |null|
+|modelPackage|package for generated models| |null|
+|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
+|moduleName|module name for AMD, Node or globals (Default: generated from <projectName>)| |null|
+|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
+|projectDescription|description of the project (Default: using info.description or "Client library of <projectName>")| |null|
+|projectName|name of the project (Default: generated from info.title or "openapi-js-client")| |null|
+|projectVersion|version of the project (Default: using info.version or "1.0.0")| |null|
+|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
+|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+|sourceFolder|source folder for generated code| |src|
+|useInheritance|use JavaScript prototype chains & delegation for inheritance| |true|
+|usePromises|use Promises as return values from the client API, instead of superagent callbacks| |false|
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+|array|Array|
+|list|Array|
+|map|Object|
+|set|Array|
+
+
+## LANGUAGE PRIMITIVES
+
+
+
Array
+
Blob
+
Boolean
+
Date
+
File
+
Number
+
Object
+
String
+
+
+## RESERVED WORDS
+
+
+
Array
+
Date
+
Infinity
+
Math
+
NaN
+
Number
+
Object
+
String
+
abstract
+
arguments
+
boolean
+
break
+
byte
+
case
+
catch
+
char
+
class
+
const
+
continue
+
debugger
+
default
+
delete
+
do
+
double
+
else
+
enum
+
eval
+
export
+
extends
+
false
+
final
+
finally
+
float
+
for
+
function
+
goto
+
hasOwnProperty
+
if
+
implements
+
import
+
in
+
instanceof
+
int
+
interface
+
isFinite
+
isNaN
+
isPrototypeOf
+
let
+
long
+
native
+
new
+
null
+
package
+
private
+
protected
+
prototype
+
public
+
return
+
short
+
static
+
super
+
switch
+
synchronized
+
this
+
throw
+
throws
+
toString
+
transient
+
true
+
try
+
typeof
+
undefined
+
valueOf
+
var
+
void
+
volatile
+
while
+
with
+
yield
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✗|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✗|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✓|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✓|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✓|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✓|OAS2,OAS3
+|ApiKey|✓|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✓|OAS3
+|OAuth2_Implicit|✓|OAS2,OAS3
+|OAuth2_Password|✓|OAS2,OAS3
+|OAuth2_ClientCredentials|✓|OAS2,OAS3
+|OAuth2_AuthorizationCode|✓|OAS2,OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/docs/generators/javascript-apollo.md b/docs/generators/javascript-apollo.md
index 59150ad9e83..e128d136e24 100644
--- a/docs/generators/javascript-apollo.md
+++ b/docs/generators/javascript-apollo.md
@@ -7,7 +7,7 @@ title: Documentation for the javascript-apollo Generator
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | javascript-apollo | pass this to the generate command after -g |
-| generator stability | BETA | |
+| generator stability | DEPRECATED | |
| generator type | CLIENT | |
| generator language | Javascript | |
| generator default templating engine | mustache | |
@@ -22,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiPackage|package for generated api classes| |null|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|emitJSDoc|generate JSDoc comments| |true|
+|emitModelMethods|generate getters and setters for model properties| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
@@ -40,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|
|useInheritance|use JavaScript prototype chains & delegation for inheritance| |true|
+|usePromises|use Promises as return values from the client API, instead of superagent callbacks| |false|
## IMPORT MAPPING
@@ -54,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|array|Array|
|list|Array|
|map|Object|
+|set|Array|
## LANGUAGE PRIMITIVES
@@ -72,9 +75,16 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
+
Array
+
Date
+
Infinity
+
Math
+
NaN
+
Number
+
Object
+
String
abstract
arguments
-
array
boolean
break
byte
@@ -84,7 +94,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
class
const
continue
-
date
debugger
default
delete
@@ -102,27 +111,22 @@ These options may be applied as additional-properties (cli) or configOptions (pl
for
function
goto
-
hasownproperty
+
hasOwnProperty
if
implements
import
in
-
infinity
instanceof
int
interface
-
isfinite
-
isnan
-
isprototypeof
+
isFinite
+
isNaN
+
isPrototypeOf
let
long
-
math
-
nan
native
new
null
-
number
-
object
package
private
protected
@@ -131,20 +135,19 @@ These options may be applied as additional-properties (cli) or configOptions (pl
return
short
static
-
string
super
switch
synchronized
this
throw
throws
-
tostring
+
toString
transient
true
try
typeof
undefined
-
valueof
+
valueOf
var
void
volatile
diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md
index 5c1c2b4724e..b9259f14ab6 100644
--- a/docs/generators/javascript.md
+++ b/docs/generators/javascript.md
@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|invokerPackage|root package for generated code| |null|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
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.
|true|
+|library|library template (sub-template)|
**javascript**
JavaScript client library
**apollo**
Apollo REST DataSource
|javascript|
|licenseName|name of the license the project uses (Default: using info.license.name)| |null|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md
index 8daa145ec43..ee8399a2a4c 100644
--- a/docs/generators/kotlin-server.md
+++ b/docs/generators/kotlin-server.md
@@ -105,6 +105,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
const
constructor
continue
+
contract
crossinline
data
delegate
diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md
index 030356edbc1..a7de5eea623 100644
--- a/docs/generators/kotlin-spring.md
+++ b/docs/generators/kotlin-spring.md
@@ -114,6 +114,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
const
constructor
continue
+
contract
crossinline
data
delegate
diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md
index 6080b3c98bb..7a25d890a72 100644
--- a/docs/generators/kotlin-vertx.md
+++ b/docs/generators/kotlin-vertx.md
@@ -93,6 +93,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
const
constructor
continue
+
contract
crossinline
data
delegate
diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md
index 473ee4ec3dd..7f562302f28 100644
--- a/docs/generators/kotlin.md
+++ b/docs/generators/kotlin.md
@@ -107,6 +107,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
const
constructor
continue
+
contract
crossinline
data
delegate
diff --git a/docs/generators/php-dt.md b/docs/generators/php-dt.md
index 752e5027cd7..7f9d0789bd5 100644
--- a/docs/generators/php-dt.md
+++ b/docs/generators/php-dt.md
@@ -56,7 +56,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md
index 122c3f56cc0..9c606506d75 100644
--- a/docs/generators/php-laravel.md
+++ b/docs/generators/php-laravel.md
@@ -57,7 +57,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md
index f8b02f001ce..28ac527eef4 100644
--- a/docs/generators/php-lumen.md
+++ b/docs/generators/php-lumen.md
@@ -57,7 +57,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-mezzio-ph.md b/docs/generators/php-mezzio-ph.md
index f94d54b3b3e..01cb9eb6ccd 100644
--- a/docs/generators/php-mezzio-ph.md
+++ b/docs/generators/php-mezzio-ph.md
@@ -56,7 +56,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-slim-deprecated.md b/docs/generators/php-slim-deprecated.md
index 508fe455b35..f5844cd7096 100644
--- a/docs/generators/php-slim-deprecated.md
+++ b/docs/generators/php-slim-deprecated.md
@@ -57,7 +57,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md
index a995e883495..fd30427de47 100644
--- a/docs/generators/php-slim4.md
+++ b/docs/generators/php-slim4.md
@@ -58,7 +58,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md
index 608dee49383..f818259b0e8 100644
--- a/docs/generators/php-symfony.md
+++ b/docs/generators/php-symfony.md
@@ -62,7 +62,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
array
bool
byte
-
double
float
int
mixed
diff --git a/docs/generators/php.md b/docs/generators/php.md
index 7d71c4ce009..298d059c381 100644
--- a/docs/generators/php.md
+++ b/docs/generators/php.md
@@ -58,7 +58,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
bool
boolean
byte
-
double
float
int
integer
diff --git a/docs/generators/protobuf-schema.md b/docs/generators/protobuf-schema.md
index b61298ede4b..e4b37f2a86a 100644
--- a/docs/generators/protobuf-schema.md
+++ b/docs/generators/protobuf-schema.md
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|repeat|
+|set|repeat|
## LANGUAGE PRIMITIVES
@@ -47,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
int32
int64
map
+
set
sfixed32
sfixed64
sint32
diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md
index d2ba3f9ec02..2f6f7e4e510 100644
--- a/docs/generators/python-aiohttp.md
+++ b/docs/generators/python-aiohttp.md
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md
index 9e10d91343f..ce4b7ae98dd 100644
--- a/docs/generators/python-blueplanet.md
+++ b/docs/generators/python-blueplanet.md
@@ -10,7 +10,7 @@ title: Documentation for the python-blueplanet Generator
| generator stability | STABLE | |
| generator type | SERVER | |
| generator language | Python | |
-| generator language version | 2.7+ and 3.5.2+ | |
+| generator language version | 3.5.2+ | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python server library using the Connexion project. By default, it will also generate service classes -- which you can disable with the `-Dnoservice` environment variable. | |
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/docs/generators/python-experimental.md b/docs/generators/python-experimental.md
deleted file mode 100644
index ab5862d321b..00000000000
--- a/docs/generators/python-experimental.md
+++ /dev/null
@@ -1,242 +0,0 @@
----
-title: Documentation for the python-experimental Generator
----
-
-## METADATA
-
-| Property | Value | Notes |
-| -------- | ----- | ----- |
-| generator name | python-experimental | pass this to the generate command after -g |
-| generator stability | EXPERIMENTAL | |
-| generator type | CLIENT | |
-| generator language | Python | |
-| generator language version | >=3.9 | |
-| generator default templating engine | handlebars | |
-| helpTxt | Generates a Python client library
Features in this generator: - type hints on endpoints and model creation - model parameter names use the spec defined keys and cases - robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only - endpoint parameter names use the spec defined keys and cases - inline schemas are supported at any location including composition - multiple content types supported in request body and response bodies - run time type checking - Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema - Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema - quicker load time for python modules (a single endpoint can be imported and used without loading others) - all instances of schemas dynamically inherit from all matching schemas so one can use isinstance to check if validation passed - composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf) - schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor - Exceptions: int/float is stored as Decimal, When receiving data from headers it will start as str and may need to be cast for example to int | |
-
-## CONFIG OPTIONS
-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.
-
-| Option | Description | Values | Default |
-| ------ | ----------- | ------ | ------- |
-|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
-|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
-|library|library template (sub-template) to use: urllib3| |urllib3|
-|packageName|python package name (convention: snake_case).| |openapi_client|
-|packageUrl|python package URL.| |null|
-|packageVersion|python package version.| |1.0.0|
-|projectName|python project name in setup.py (e.g. petstore-api).| |null|
-|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
-|useInlineModelResolver|use the inline model resolver, if true inline complex models will be extracted into components and $refs to them will be used| |false|
-|useNose|use the nose test framework| |false|
-
-## IMPORT MAPPING
-
-| Type/Alias | Imports |
-| ---------- | ------- |
-
-
-## INSTANTIATION TYPES
-
-| Type/Alias | Instantiated By |
-| ---------- | --------------- |
-|map|dict|
-
-
-## LANGUAGE PRIMITIVES
-
-
-
bool
-
bytes
-
date
-
datetime
-
dict
-
file
-
file_type
-
float
-
int
-
list
-
none_type
-
object
-
str
-
-
-## RESERVED WORDS
-
-
-
all_params
-
and
-
as
-
assert
-
async
-
auth_settings
-
await
-
body_params
-
bool
-
break
-
class
-
continue
-
def
-
del
-
dict
-
elif
-
else
-
except
-
exec
-
false
-
file_type
-
finally
-
float
-
for
-
form_params
-
from
-
frozendict
-
global
-
header_params
-
if
-
import
-
in
-
int
-
is
-
lambda
-
list
-
local_var_files
-
none
-
none_type
-
nonlocal
-
not
-
or
-
pass
-
path_params
-
print
-
property
-
query_params
-
raise
-
resource_path
-
return
-
self
-
str
-
true
-
try
-
tuple
-
while
-
with
-
yield
-
-
-## FEATURE SET
-
-
-### Client Modification Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|BasePath|✗|ToolingExtension
-|Authorizations|✗|ToolingExtension
-|UserAgent|✗|ToolingExtension
-|MockServer|✗|ToolingExtension
-
-### Data Type Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|Custom|✗|OAS2,OAS3
-|Int32|✓|OAS2,OAS3
-|Int64|✓|OAS2,OAS3
-|Float|✓|OAS2,OAS3
-|Double|✓|OAS2,OAS3
-|Decimal|✓|ToolingExtension
-|String|✓|OAS2,OAS3
-|Byte|✓|OAS2,OAS3
-|Binary|✓|OAS2,OAS3
-|Boolean|✓|OAS2,OAS3
-|Date|✓|OAS2,OAS3
-|DateTime|✓|OAS2,OAS3
-|Password|✓|OAS2,OAS3
-|File|✓|OAS2
-|Uuid|✓|
-|Array|✓|OAS2,OAS3
-|Null|✓|OAS3
-|AnyType|✓|OAS2,OAS3
-|Object|✓|OAS2,OAS3
-|Maps|✓|ToolingExtension
-|CollectionFormat|✓|OAS2
-|CollectionFormatMulti|✓|OAS2
-|Enum|✓|OAS2,OAS3
-|ArrayOfEnum|✓|ToolingExtension
-|ArrayOfModel|✓|ToolingExtension
-|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
-|ArrayOfCollectionOfModel|✓|ToolingExtension
-|ArrayOfCollectionOfEnum|✓|ToolingExtension
-|MapOfEnum|✓|ToolingExtension
-|MapOfModel|✓|ToolingExtension
-|MapOfCollectionOfPrimitives|✓|ToolingExtension
-|MapOfCollectionOfModel|✓|ToolingExtension
-|MapOfCollectionOfEnum|✓|ToolingExtension
-
-### Documentation Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|Readme|✓|ToolingExtension
-|Model|✓|ToolingExtension
-|Api|✓|ToolingExtension
-
-### Global Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|Host|✓|OAS2,OAS3
-|BasePath|✓|OAS2,OAS3
-|Info|✓|OAS2,OAS3
-|Schemes|✗|OAS2,OAS3
-|PartialSchemes|✓|OAS2,OAS3
-|Consumes|✓|OAS2
-|Produces|✓|OAS2
-|ExternalDocumentation|✓|OAS2,OAS3
-|Examples|✓|OAS2,OAS3
-|XMLStructureDefinitions|✗|OAS2,OAS3
-|MultiServer|✗|OAS3
-|ParameterizedServer|✓|OAS3
-|ParameterStyling|✓|OAS3
-|Callbacks|✗|OAS3
-|LinkObjects|✗|OAS3
-
-### Parameter Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|Path|✓|OAS2,OAS3
-|Query|✓|OAS2,OAS3
-|Header|✓|OAS2,OAS3
-|Body|✓|OAS2
-|FormUnencoded|✓|OAS2
-|FormMultipart|✓|OAS2
-|Cookie|✗|OAS3
-
-### Schema Support Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|Simple|✓|OAS2,OAS3
-|Composite|✓|OAS2,OAS3
-|Polymorphism|✓|OAS2,OAS3
-|Union|✓|OAS3
-|allOf|✓|OAS2,OAS3
-|anyOf|✓|OAS3
-|oneOf|✓|OAS3
-|not|✓|OAS3
-
-### Security Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|BasicAuth|✓|OAS2,OAS3
-|ApiKey|✓|OAS2,OAS3
-|OpenIDConnect|✗|OAS3
-|BearerToken|✓|OAS3
-|OAuth2_Implicit|✓|OAS2,OAS3
-|OAuth2_Password|✗|OAS2,OAS3
-|OAuth2_ClientCredentials|✗|OAS2,OAS3
-|OAuth2_AuthorizationCode|✗|OAS2,OAS3
-
-### Wire Format Feature
-| Name | Supported | Defined By |
-| ---- | --------- | ---------- |
-|JSON|✓|OAS2,OAS3
-|XML|✗|OAS2,OAS3
-|PROTOBUF|✗|ToolingExtension
-|Custom|✓|OAS2,OAS3
diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md
index 2c82d539007..5624ecb8a04 100644
--- a/docs/generators/python-flask.md
+++ b/docs/generators/python-flask.md
@@ -10,7 +10,7 @@ title: Documentation for the python-flask Generator
| generator stability | STABLE | |
| generator type | SERVER | |
| generator language | Python | |
-| generator language version | 2.7 and 3.5.2+ | |
+| generator language version | 3.5.2+ | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Python server library using the Connexion project. By default, it will also generate service classes -- which you can disable with the `-Dnoservice` environment variable. | |
@@ -34,7 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|TCP port to listen to in app.run| |8080|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
-|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|testsUsePythonSrcRoot|generates test under the pythonSrcRoot folder.| |false|
|useNose|use the nose test framework| |false|
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
diff --git a/docs/generators/python-prior.md b/docs/generators/python-prior.md
new file mode 100644
index 00000000000..00a89120d77
--- /dev/null
+++ b/docs/generators/python-prior.md
@@ -0,0 +1,233 @@
+---
+title: Documentation for the python-prior Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | python-prior | pass this to the generate command after -g |
+| generator stability | STABLE | |
+| generator type | CLIENT | |
+| generator language | Python | |
+| generator language version | >=3.6 | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a Python client library. | |
+
+## CONFIG OPTIONS
+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.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. NOTE: this option breaks composition and will be removed in 6.0.0
|false|
+|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|initRequiredVars|If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.| |false|
+|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
+|packageName|python package name (convention: snake_case).| |openapi_client|
+|packageUrl|python package URL.| |null|
+|packageVersion|python package version.| |1.0.0|
+|projectName|python project name in setup.py (e.g. petstore-api).| |null|
+|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
+|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
+|useNose|use the nose test framework| |false|
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+
+
+## LANGUAGE PRIMITIVES
+
+
+
bool
+
bytes
+
date
+
datetime
+
dict
+
file
+
file_type
+
float
+
int
+
list
+
none_type
+
object
+
str
+
+
+## RESERVED WORDS
+
+
+
all_params
+
and
+
as
+
assert
+
async
+
auth_settings
+
await
+
body_params
+
break
+
class
+
continue
+
def
+
del
+
elif
+
else
+
except
+
exec
+
false
+
finally
+
for
+
form_params
+
from
+
global
+
header_params
+
if
+
import
+
in
+
is
+
lambda
+
local_var_files
+
none
+
nonlocal
+
not
+
or
+
pass
+
path_params
+
print
+
property
+
query_params
+
raise
+
resource_path
+
return
+
self
+
true
+
try
+
while
+
with
+
yield
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✗|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✓|ToolingExtension
+|Model|✓|ToolingExtension
+|Api|✓|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✓|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✗|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✗|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✗|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✓|OAS2,OAS3
+|ApiKey|✓|OAS2,OAS3
+|OpenIDConnect|✗|OAS3
+|BearerToken|✓|OAS3
+|OAuth2_Implicit|✓|OAS2,OAS3
+|OAuth2_Password|✗|OAS2,OAS3
+|OAuth2_ClientCredentials|✗|OAS2,OAS3
+|OAuth2_AuthorizationCode|✗|OAS2,OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✓|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✓|OAS2,OAS3
diff --git a/docs/generators/python.md b/docs/generators/python.md
index 34875d8c863..4cbf616d091 100644
--- a/docs/generators/python.md
+++ b/docs/generators/python.md
@@ -10,26 +10,25 @@ title: Documentation for the python Generator
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | Python | |
-| generator language version | >=3.6 | |
-| generator default templating engine | mustache | |
-| helpTxt | Generates a Python client library. | |
+| generator language version | >=3.7 | |
+| generator default templating engine | handlebars | |
+| helpTxt | Generates a Python client library
Features in this generator: - type hints on endpoints and model creation - model parameter names use the spec defined keys and cases - robust composition (oneOf/anyOf/allOf/not) where payload data is stored in one instance only - endpoint parameter names use the spec defined keys and cases - inline schemas are supported at any location including composition - multiple content types supported in request body and response bodies - run time type checking - Sending/receiving decimals as strings supported with type:string format: number -> DecimalSchema - Sending/receiving uuids as strings supported with type:string format: uuid -> UUIDSchema - quicker load time for python modules (a single endpoint can be imported and used without loading others) - all instances of schemas dynamically inherit from all matching schemas so one can use isinstance to check if validation passed - composed schemas with type constraints supported (type:object + oneOf/anyOf/allOf) - schemas are not coerced/cast. For example string + date are both stored as string, and there is a date accessor - Exceptions: int/float is stored as Decimal, When receiving data from headers it will start as str and may need to be cast for example to int | |
## CONFIG OPTIONS
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.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
-|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. NOTE: this option breaks composition and will be removed in 6.0.0
|false|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
-|initRequiredVars|If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.| |false|
-|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
+|library|library template (sub-template) to use: urllib3| |urllib3|
+|nonCompliantUseDiscriminatorIfCompositionFails|When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a discriminator is present, then ignore the composition validation errors and attempt to use the discriminator to validate the payload.<br />Note: setting this to true makes the generated client not comply with json schema because it ignores composition validation errors. Please consider making your schemas more restrictive rather than setting this to true. You can do that by:<ul><li>defining the propertyName as an enum with only one value in the schemas that are in your discriminator map</li><li>setting additionalProperties: false in your schemas</li></ul>|
**true**
If composition fails and a discriminator exists, the composition errors will be ignored and validation will be attempted with the discriminator
**false**
Composition validation must succeed. Discriminator validation must succeed.
|false|
|packageName|python package name (convention: snake_case).| |openapi_client|
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
-|pythonAttrNoneIfUnset|when accessing unset attribute, return `None` instead of raising `ApiAttributeError`| |false|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
+|useInlineModelResolver|use the inline model resolver, if true inline complex models will be extracted into components and $refs to them will be used| |false|
|useNose|use the nose test framework| |false|
## IMPORT MAPPING
@@ -42,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Instantiated By |
| ---------- | --------------- |
+|map|dict|
## LANGUAGE PRIMITIVES
@@ -73,29 +73,37 @@ These options may be applied as additional-properties (cli) or configOptions (pl
auth_settings
await
body_params
+
bool
break
class
continue
def
del
+
dict
elif
else
except
exec
false
+
file_type
finally
+
float
for
form_params
from
+
frozendict
global
header_params
if
import
in
+
int
is
lambda
+
list
local_var_files
none
+
none_type
nonlocal
not
or
@@ -108,8 +116,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
resource_path
return
self
+
str
true
try
+
tuple
while
with
yield
@@ -143,10 +153,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
-|Uuid|✗|
+|Uuid|✓|
|Array|✓|OAS2,OAS3
-|Null|✗|OAS3
-|AnyType|✗|OAS2,OAS3
+|Null|✓|OAS3
+|AnyType|✓|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
@@ -185,7 +195,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✓|OAS3
-|ParameterStyling|✗|OAS3
+|ParameterStyling|✓|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
@@ -205,12 +215,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
-|Polymorphism|✗|OAS2,OAS3
-|Union|✗|OAS3
-|allOf|✗|OAS2,OAS3
-|anyOf|✗|OAS3
-|oneOf|✗|OAS3
-|not|✗|OAS3
+|Polymorphism|✓|OAS2,OAS3
+|Union|✓|OAS3
+|allOf|✓|OAS2,OAS3
+|anyOf|✓|OAS3
+|oneOf|✓|OAS3
+|not|✓|OAS3
### Security Feature
| Name | Supported | Defined By |
@@ -228,6 +238,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
-|XML|✓|OAS2,OAS3
+|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3
diff --git a/docs/generators/r.md b/docs/generators/r.md
index a25d0d4468d..c15ba4ad718 100644
--- a/docs/generators/r.md
+++ b/docs/generators/r.md
@@ -18,9 +18,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
+|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|errorObjectType|Error object type.| |null|
|exceptionPackage|Specify the exception handling package|
**default**
Use stop() for raising exceptions.
**rlang**
Use rlang package for exceptions.
|default|
+|generateWrapper|Generate a wrapper class (single point of access) for the R client. This option only works with `httr2` library.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|library|HTTP library template (sub-template) to use|
|httr|
+|operationIdNaming|Naming convention for operationId (function name in the API)|
**PascalCase**
Pascal case (default)
**snake_case**
Snake case
**camelCase**
Camel case
|null|
|packageName|R package name (convention: lowercase).| |openapi|
|packageVersion|R package version.| |1.0.0|
|returnExceptionOnFailure|Throw an exception on non success response codes| |false|
diff --git a/docs/generators/ruby.md b/docs/generators/ruby.md
index 703f7ef7e06..7e88dbc2cf3 100644
--- a/docs/generators/ruby.md
+++ b/docs/generators/ruby.md
@@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+|useAutoload|Use autoload instead of require to load modules.| |false|
## IMPORT MAPPING
diff --git a/docs/generators/rust-server.md b/docs/generators/rust-server.md
index ece538a608c..14cea87981d 100644
--- a/docs/generators/rust-server.md
+++ b/docs/generators/rust-server.md
@@ -11,7 +11,7 @@ title: Documentation for the rust-server Generator
| generator type | SERVER | |
| generator language | Rust | |
| generator default templating engine | mustache | |
-| helpTxt | Generates a Rust client/server library (beta) using the openapi-generator project. | |
+| helpTxt | Generates a Rust Hyper/Tower server library. Also generates a matching Hyper client library within the same crate that implements the same trait. | |
## CONFIG OPTIONS
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.
@@ -59,9 +59,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
+
Self
abstract
-
alignof
as
+
async
+
await
become
box
break
@@ -69,6 +71,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
continue
crate
do
+
dyn
else
enum
extern
@@ -86,21 +89,18 @@ These options may be applied as additional-properties (cli) or configOptions (pl
mod
move
mut
-
offsetof
override
priv
-
proc
pub
-
pure
ref
return
self
-
sizeof
static
struct
super
trait
true
+
try
type
typeof
unsafe
diff --git a/docs/generators/rust.md b/docs/generators/rust.md
index 03303f46ec4..e0ac78e6201 100644
--- a/docs/generators/rust.md
+++ b/docs/generators/rust.md
@@ -66,8 +66,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
+
Self
abstract
-
alignof
as
async
await
@@ -96,16 +96,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
mod
move
mut
-
offsetof
override
priv
-
proc
pub
-
pure
ref
return
self
-
sizeof
static
struct
super
diff --git a/docs/generators/scala-sttp.md b/docs/generators/scala-sttp.md
index 089a70ac989..c56f756df9e 100644
--- a/docs/generators/scala-sttp.md
+++ b/docs/generators/scala-sttp.md
@@ -53,6 +53,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
+|Seq|scala.collection.immutable.Seq|
+|Set|scala.collection.immutable.Set|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md
index 92d3265b1bc..2fc6ba96fbc 100644
--- a/docs/generators/swift5.md
+++ b/docs/generators/swift5.md
@@ -53,6 +53,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|useClasses|Use final classes for models instead of structs (default: false)| |false|
+|useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false|
|useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
@@ -83,6 +84,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
Int
Int32
Int64
+
OpenAPIDateWithoutTime
String
URL
UUID
diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md
index f41324a02ed..7fde34c39a3 100644
--- a/docs/generators/typescript-angular.md
+++ b/docs/generators/typescript-angular.md
@@ -11,7 +11,7 @@ title: Documentation for the typescript-angular Generator
| generator type | CLIENT | |
| generator language | Typescript | |
| generator default templating engine | mustache | |
-| helpTxt | Generates a TypeScript Angular (9.x - 13.x) client library. | |
+| helpTxt | Generates a TypeScript Angular (9.x - 14.x) client library. | |
## CONFIG OPTIONS
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.
@@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null|
-|ngVersion|The version of Angular. (At least 9.0.0)| |13.0.1|
+|ngVersion|The version of Angular. (At least 9.0.0)| |14.0.5|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
@@ -232,7 +232,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
-|ParameterStyling|✗|OAS3
+|ParameterStyling|✓|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md
index 99d70502c6c..38720fb9411 100644
--- a/docs/generators/typescript-nestjs.md
+++ b/docs/generators/typescript-nestjs.md
@@ -11,7 +11,7 @@ title: Documentation for the typescript-nestjs Generator
| generator type | CLIENT | |
| generator language | Typescript | |
| generator default templating engine | mustache | |
-| helpTxt | Generates a TypeScript Nestjs 6.x client library. | |
+| helpTxt | Generates a TypeScript Nestjs 8.x or 6.x client library. | |
## CONFIG OPTIONS
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.
@@ -29,7 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null|
-|nestVersion|The version of Nestjs.| |6.0.0|
+|nestVersion|The version of Nestjs.|
**8.0.0**
Use new HttpModule and HttpService from @nestjs/axios.
**6.0.0**
Use old HttpModule and HttpService from @nestjs/common.
|8.0.0|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
diff --git a/docs/installation.md b/docs/installation.md
index 4aadfcbf3e5..c56c97a00d0 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -103,18 +103,18 @@ docker run --rm \
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
-JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar`
+JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.0/openapi-generator-cli-6.2.0.jar`
For **Mac/Linux** users:
```bash
-wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar -O openapi-generator-cli.jar
+wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.0/openapi-generator-cli-6.2.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```powershell
-Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar
+Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.0/openapi-generator-cli-6.2.0.jar
```
diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc
index 9f993fb5482..9982ec5e12f 100644
--- a/modules/openapi-generator-gradle-plugin/README.adoc
+++ b/modules/openapi-generator-gradle-plugin/README.adoc
@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
[source,group]
----
plugins {
- id "org.openapi.generator" version "6.0.1"
+ id "org.openapi.generator" version "6.2.0"
}
----
@@ -113,7 +113,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
- classpath "org.openapitools:openapi-generator-gradle-plugin:6.0.1"
+ classpath "org.openapitools:openapi-generator-gradle-plugin:6.2.0"
}
}
@@ -695,7 +695,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
- classpath('org.openapitools:openapi-generator-gradle-plugin:6.0.1') {
+ classpath('org.openapitools:openapi-generator-gradle-plugin:6.2.0') {
exclude group: 'com.google.guava'
}
}
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md
index d3ffccdb695..6428a36a3c9 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md
@@ -1,6 +1,6 @@
# Local Spec Sample
-This example assumes you have Gradle 5.6.4+ installed. No gradle wrapper is provided in samples.
+This example assumes you have Gradle 6.8.3+ installed. No gradle wrapper is provided in samples.
First, publish the openapi-generator-gradle-plugin locally via `./gradlew assemble publishToMavenLocal` in the module directory.
@@ -12,11 +12,12 @@ gradle openApiMeta # expected outcome: BUILD SUCCESSFUL
gradle openApiValidate # expected outcome: BUILD FAILED
gradle buildGoSdk # expected outcome: BUILD SUCCESSFUL
gradle buildDotnetSdk # expected outcome: BUILD SUCCESSFUL
+gradle buildJavaResttemplateSdk # expected outcome: BUILD SUCCESSFUL
gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
```
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
-gradle -PopenApiGeneratorVersion=6.0.1 openApiValidate
+gradle -PopenApiGeneratorVersion=6.2.0 openApiValidate
```
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle b/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle
index cb99b8838fa..06e7ed8891c 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle
@@ -54,6 +54,25 @@ openApiGenerate {
enablePostProcessFile = false
}
+task buildJavaResttemplateSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
+ generatorName = "java"
+ library = "resttemplate"
+ inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
+ outputDir = "$buildDir/java-resttemplate-api-client"
+ apiPackage = "com.example.client"
+ invokerPackage = "com.example.invoker"
+ modelPackage = "com.example.cdm"
+ configOptions = [
+ dateLibrary: "java8"
+ ]
+ groupId = 'com.example'
+ id = 'client'
+ skipValidateSpec = true
+ logToStderr = true
+ generateAliasAsModel = false
+ enablePostProcessFile = false
+}
+
task buildGoSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
generatorName = "go"
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
index 5028f28f8e4..442d9132ea3 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew
index 2fe81a7d95e..20b741fb46c 100755
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew
@@ -44,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -92,14 +93,12 @@ if [ -n "$JAVA_HOME" ] ; then
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
@@ -129,6 +128,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat
index 9618d8d9607..6a68175eb70 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat
@@ -29,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
index 2adddbdfcf8..82fe7e761e8 100644
--- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
+++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
@@ -495,12 +495,14 @@ open class GenerateTask : DefaultTask() {
}
}
+ protected open fun createDefaultCodegenConfigurator(): CodegenConfigurator = CodegenConfigurator()
+
@Suppress("unused")
@TaskAction
fun doWork() {
val configurator: CodegenConfigurator = if (configFile.isPresent) {
CodegenConfigurator.fromFile(configFile.get())
- } else CodegenConfigurator()
+ } else createDefaultCodegenConfigurator()
try {
if (globalProperties.isPresent) {
diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md
index cfa93b506dd..38e54029cd7 100644
--- a/modules/openapi-generator-maven-plugin/README.md
+++ b/modules/openapi-generator-maven-plugin/README.md
@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
org.openapitoolsopenapi-generator-maven-plugin
- 6.0.1
+ 6.2.0
diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java
index 44e49ca5211..f796ca6002a 100644
--- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java
+++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java
@@ -95,8 +95,7 @@ public class CodeGenMojo extends AbstractMojo {
/**
* Location of the output directory.
*/
- @Parameter(name = "output", property = "openapi.generator.maven.plugin.output",
- defaultValue = "${project.build.directory}/generated-sources/openapi")
+ @Parameter(name = "output", property = "openapi.generator.maven.plugin.output")
private File output;
/**
@@ -464,6 +463,12 @@ public class CodeGenMojo extends AbstractMojo {
@Override
public void execute() throws MojoExecutionException {
File inputSpecFile = new File(inputSpec);
+
+ if (output == null) {
+ output = new File(project.getBuild().getDirectory(),
+ LifecyclePhase.GENERATE_TEST_SOURCES.id().equals(mojo.getLifecyclePhase()) ?
+ "generated-test-sources/openapi" : "generated-sources/openapi");
+ }
addCompileSourceRootIfConfigured();
try {
@@ -913,21 +918,16 @@ public class CodeGenMojo extends AbstractMojo {
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
}
- return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + "-" + mojo.getExecutionId() + ".sha256");
+ return new File(output.getPath() + File.separatorChar + ".openapi-generator" + File.separatorChar + name + "-" + mojo.getExecutionId() + ".sha256");
}
private String getCompileSourceRoot() {
final Object sourceFolderObject =
configOptions == null ? null : configOptions
.get(CodegenConstants.SOURCE_FOLDER);
- final String sourceFolder;
- if (sourceFolderObject != null) {
- sourceFolder = sourceFolderObject.toString();
- } else {
- sourceFolder = addTestCompileSourceRoot ? "src/test/java" : "src/main/java";
- }
+ final String sourceFolder = sourceFolderObject != null ? sourceFolderObject.toString() : "src/main/java";
- return output.toString() + "/" + sourceFolder;
+ return output.getPath() + File.separatorChar + sourceFolder;
}
private void addCompileSourceRootIfConfigured() throws MojoExecutionException {
diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml
index 44f602e74da..e2baf341d1f 100644
--- a/modules/openapi-generator/pom.xml
+++ b/modules/openapi-generator/pom.xml
@@ -247,11 +247,6 @@
-
- io.swagger.core.v3
- swagger-core
- ${swagger-core.version}
- ${swagger-parser-groupid.version}swagger-parser
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java
index 1890fc0d73d..2917c2ee0a9 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java
@@ -328,4 +328,6 @@ public interface CodegenConfig {
List getSupportedVendorExtensions();
boolean getUseInlineModelResolver();
+
+ boolean getAddSuffixToDuplicateOperationNicknames();
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
index 1efd6b2502f..2ee0c5474f8 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
@@ -388,7 +388,10 @@ public class CodegenConstants {
public static final String DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC =
"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.";
-
+ public static final String UNSUPPORTED_V310_SPEC_MSG =
+ "Generation using 3.1.0 specs is in development and is not officially supported yet. " +
+ "If you would like to expedite development, please consider woking on the open issues in the 3.1.0 project: https://github.com/orgs/OpenAPITools/projects/4/views/1 " +
+ "and reach out to our team on Slack at https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g";
public static final String ENUM_UNKNOWN_DEFAULT_CASE = "enumUnknownDefaultCase";
public static final String ENUM_UNKNOWN_DEFAULT_CASE_DESC =
"If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response." +
@@ -401,4 +404,15 @@ public class CodegenConstants {
public static final String ERROR_OBJECT_TYPE = "errorObjectType";
+ public static final String NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS = "nonCompliantUseDiscriminatorIfCompositionFails";
+
+ public static final String NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS_DESC =
+ "When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a " +
+ "discriminator is present, then ignore the composition validation errors and attempt to use the " +
+ "discriminator to validate the payload. " +
+ "Note: setting this to true makes the generated client not comply with json schema because it ignores " +
+ "composition validation errors. Please consider making your schemas more restrictive rather than " +
+ "setting this to true. You can do that by:
" +
+ "
defining the propertyName as an enum with only one value in the schemas that are in your discriminator map
" +
+ "
setting additionalProperties: false in your schemas
";
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
index dc99a945859..6cef953b7d6 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
@@ -22,6 +22,7 @@ public class CodegenDiscriminator {
private String propertyGetter;
private String propertyType;
private Map mapping;
+ private boolean isEnum;
// mappedModels is populated differently if legacyDiscriminatorBehavior is
// True or False. When:
@@ -88,6 +89,14 @@ public class CodegenDiscriminator {
this.mappedModels = mappedModels;
}
+ public boolean getIsEnum() {
+ return isEnum;
+ }
+
+ public void setIsEnum(boolean isEnum) {
+ this.isEnum = isEnum;
+ }
+
/**
* An object to hold discriminator mappings between payload values and schema names or
* references.
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenMediaType.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenMediaType.java
index 965e5031942..2728bc632fa 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenMediaType.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenMediaType.java
@@ -1,15 +1,20 @@
package org.openapitools.codegen;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Objects;
public class CodegenMediaType {
private CodegenProperty schema;
private LinkedHashMap encoding;
+ private HashMap testCases = new HashMap<>();
- public CodegenMediaType(CodegenProperty schema, LinkedHashMap encoding) {
+ public CodegenMediaType(CodegenProperty schema, LinkedHashMap encoding, HashMap testCases) {
this.schema = schema;
this.encoding = encoding;
+ if (testCases != null) {
+ this.testCases = testCases;
+ }
}
public CodegenProperty getSchema() {
@@ -20,6 +25,8 @@ public class CodegenMediaType {
return encoding;
}
+ public HashMap getTestCases() { return testCases; }
+
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenMediaType{");
sb.append("schema=").append(schema);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
index a8107fb07d0..26d06d5fbb6 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
@@ -111,6 +111,12 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
public HashMap testCases = new HashMap<>();
+ private boolean schemaIsFromAdditionalProperties;
+ private boolean isBooleanSchemaTrue;
+ private boolean isBooleanSchemaFalse;
+ private String format;
+ private LinkedHashMap> dependentRequired;
+ private CodegenProperty contains;
/**
* The type of the value for the additionalProperties keyword in the OAS document.
@@ -147,6 +153,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private Integer maxProperties;
private Integer minProperties;
private boolean uniqueItems;
+ private Boolean uniqueItemsBoolean;
private Integer maxItems;
private Integer minItems;
private Integer maxLength;
@@ -164,6 +171,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private boolean hasDiscriminatorWithNonEmptyMapping;
private boolean isAnyType;
private boolean isUuid;
+ private Map requiredVarsMap;
+ private String ref;
public String getAdditionalPropertiesType() {
return additionalPropertiesType;
@@ -173,6 +182,76 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.additionalPropertiesType = additionalPropertiesType;
}
+ @Override
+ public CodegenProperty getContains() {
+ return contains;
+ }
+
+ @Override
+ public void setContains(CodegenProperty contains) {
+ this.contains = contains;
+ }
+
+ @Override
+ public LinkedHashMap> getDependentRequired() {
+ return dependentRequired;
+ }
+
+ @Override
+ public void setDependentRequired(LinkedHashMap> dependentRequired) {
+ this.dependentRequired = dependentRequired;
+ }
+
+ @Override
+ public boolean getIsBooleanSchemaTrue() {
+ return isBooleanSchemaTrue;
+ }
+
+ @Override
+ public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {
+ this.isBooleanSchemaTrue = isBooleanSchemaTrue;
+ }
+
+ @Override
+ public boolean getIsBooleanSchemaFalse() {
+ return isBooleanSchemaFalse;
+ }
+
+ @Override
+ public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {
+ this.isBooleanSchemaFalse = isBooleanSchemaFalse;
+ }
+
+ @Override
+ public String getFormat() {
+ return format;
+ }
+
+ @Override
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ @Override
+ public String getRef() {
+ return ref;
+ }
+
+ @Override
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ @Override
+ public boolean getSchemaIsFromAdditionalProperties() {
+ return schemaIsFromAdditionalProperties;
+ }
+
+ @Override
+ public void setSchemaIsFromAdditionalProperties(boolean schemaIsFromAdditionalProperties) {
+ this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
+ }
+
public Set getAllMandatory() {
return allMandatory;
}
@@ -546,6 +625,16 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.uniqueItems = uniqueItems;
}
+ @Override
+ public Boolean getUniqueItemsBoolean() {
+ return uniqueItemsBoolean;
+ }
+
+ @Override
+ public void setUniqueItemsBoolean(Boolean uniqueItemsBoolean) {
+ this.uniqueItemsBoolean = uniqueItemsBoolean;
+ }
+
@Override
public Integer getMinProperties() {
return minProperties;
@@ -825,8 +914,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
return hasDiscriminatorWithNonEmptyMapping;
}
- ;
-
@Override
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
@@ -923,11 +1010,20 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
isUuid == that.getIsUuid() &&
+ isBooleanSchemaTrue == that.getIsBooleanSchemaTrue() &&
+ isBooleanSchemaFalse == that.getIsBooleanSchemaFalse() &&
+ getSchemaIsFromAdditionalProperties() == that.getSchemaIsFromAdditionalProperties() &&
getIsAnyType() == that.getIsAnyType() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getUniqueItems() == that.getUniqueItems() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
+ Objects.equals(contains, that.getContains()) &&
+ Objects.equals(dependentRequired, that.getDependentRequired()) &&
+ Objects.equals(format, that.getFormat()) &&
+ Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
+ Objects.equals(ref, that.getRef()) &&
+ Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(parent, that.parent) &&
Objects.equals(parentSchema, that.parentSchema) &&
@@ -1000,7 +1096,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
- isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid);
+ isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref,
+ uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
+ format, dependentRequired, contains);
}
@Override
@@ -1075,6 +1173,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", maxProperties=").append(maxProperties);
sb.append(", minProperties=").append(minProperties);
sb.append(", uniqueItems=").append(uniqueItems);
+ sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
sb.append(", maxItems=").append(maxItems);
sb.append(", minItems=").append(minItems);
sb.append(", maxLength=").append(maxLength);
@@ -1097,6 +1196,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", isDecimal=").append(isDecimal);
sb.append(", isUUID=").append(isUuid);
+ sb.append(", requiredVarsMap=").append(requiredVarsMap);
+ sb.append(", ref=").append(ref);
+ sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
+ sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
+ sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
+ sb.append(", format=").append(format);
+ sb.append(", dependentRequired=").append(dependentRequired);
+ sb.append(", contains=").append(contains);
sb.append('}');
return sb.toString();
}
@@ -1124,6 +1231,12 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
return this.items != null;
}
+ @Override
+ public Map getRequiredVarsMap() { return requiredVarsMap; }
+
+ @Override
+ public void setRequiredVarsMap(Map requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; }
+
/**
* Remove duplicated properties in all variable list
*/
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
index 16daa41f580..2672a1709a3 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
@@ -27,7 +27,7 @@ public class CodegenOperation {
public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, hasRequiredParams,
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
isArray, isMultipart,
- isResponseBinary = false, isResponseFile = false, isResponseOptional = false, hasReference = false,
+ isResponseBinary = false, isResponseFile = false, isResponseOptional = false, hasReference = false, defaultReturnType = false,
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined
@@ -193,6 +193,27 @@ public class CodegenOperation {
return responses.stream().anyMatch(response -> response.isDefault);
}
+ public boolean getAllResponsesAreErrors() {
+ return responses.stream().allMatch(response -> response.is4xx || response.is5xx);
+ }
+
+ /**
+ * @return contentTypeToOperation
+ * returns a map where the key is the request body content type and the value is the current CodegenOperation
+ * this is needed by templates when a different signature is needed for each request body content type
+ */
+ public Map getContentTypeToOperation() {
+ LinkedHashMap contentTypeToOperation = new LinkedHashMap<>();
+ if (bodyParam == null) {
+ return null;
+ }
+ LinkedHashMap content = bodyParam.getContent();
+ for (String contentType: content.keySet()) {
+ contentTypeToOperation.put(contentType, this);
+ }
+ return contentTypeToOperation;
+ }
+
/**
* Check if there's at least one vendor extension
*
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
index af222869bfe..ca8ac29eb31 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
@@ -29,7 +29,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
isCookieParam, isBodyParam, isContainer,
isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, isDeepObject, isAllowEmptyValue;
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, contentType,
- collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style;
+ collectionFormat, description, unescapedDescription, baseType, defaultValue, enumDefaultValue, enumName, style;
public String nameInLowerCase; // property name in lower case
public String example; // example value (x-example)
@@ -99,6 +99,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
* See http://json-schema.org/latest/json-schema-validation.html#anchor49
*/
public boolean uniqueItems;
+ private Boolean uniqueItemsBoolean;
/**
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
*/
@@ -111,6 +112,10 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
private LinkedHashMap content;
+ private Map requiredVarsMap;
+ private String ref;
+
+ private boolean schemaIsFromAdditionalProperties;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@@ -146,9 +151,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.maxItems = this.maxItems;
output.minItems = this.minItems;
output.uniqueItems = this.uniqueItems;
+ output.setUniqueItemsBoolean(this.uniqueItemsBoolean);
output.multipleOf = this.multipleOf;
output.jsonSchema = this.jsonSchema;
output.defaultValue = this.defaultValue;
+ output.enumDefaultValue = this.enumDefaultValue;
output.example = this.example;
output.isEnum = this.isEnum;
output.maxProperties = this.maxProperties;
@@ -163,6 +170,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.setHasRequired(this.hasRequired);
output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping);
output.setHasMultipleTypes(this.hasMultipleTypes);
+ output.setSchemaIsFromAdditionalProperties(this.schemaIsFromAdditionalProperties);
if (this.content != null) {
output.setContent(this.content);
@@ -194,6 +202,12 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
if (this.vendorExtensions != null) {
output.vendorExtensions = new HashMap(this.vendorExtensions);
}
+ if (this.requiredVarsMap != null) {
+ output.setRequiredVarsMap(this.requiredVarsMap);
+ }
+ if (this.ref != null) {
+ output.setRef(this.ref);
+ }
output.hasValidation = this.hasValidation;
output.isNullable = this.isNullable;
output.isDeprecated = this.isDeprecated;
@@ -230,7 +244,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
- return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content);
+ return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumDefaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content, requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
}
@Override
@@ -281,11 +295,15 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
hasMultipleTypes == that.getHasMultipleTypes() &&
+ getSchemaIsFromAdditionalProperties() == that.getSchemaIsFromAdditionalProperties() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getUniqueItems() == that.getUniqueItems() &&
+ Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
+ Objects.equals(ref, that.getRef()) &&
+ Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(content, that.getContent()) &&
Objects.equals(schema, that.getSchema()) &&
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
@@ -299,6 +317,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
Objects.equals(unescapedDescription, that.unescapedDescription) &&
Objects.equals(baseType, that.baseType) &&
Objects.equals(defaultValue, that.defaultValue) &&
+ Objects.equals(enumDefaultValue, that.enumDefaultValue) &&
Objects.equals(enumName, that.enumName) &&
Objects.equals(style, that.style) &&
Objects.equals(isDeepObject, that.isDeepObject) &&
@@ -350,6 +369,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", unescapedDescription='").append(unescapedDescription).append('\'');
sb.append(", baseType='").append(baseType).append('\'');
sb.append(", defaultValue='").append(defaultValue).append('\'');
+ sb.append(", enumDefaultValue='").append(enumDefaultValue).append('\'');
sb.append(", enumName='").append(enumName).append('\'');
sb.append(", style='").append(style).append('\'');
sb.append(", deepObject='").append(isDeepObject).append('\'');
@@ -404,6 +424,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", maxItems=").append(maxItems);
sb.append(", minItems=").append(minItems);
sb.append(", uniqueItems=").append(uniqueItems);
+ sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
sb.append(", contentType=").append(contentType);
sb.append(", multipleOf=").append(multipleOf);
sb.append(", isNull=").append(isNull);
@@ -415,10 +436,63 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", schema=").append(schema);
sb.append(", content=").append(content);
+ sb.append(", requiredVarsMap=").append(requiredVarsMap);
+ sb.append(", ref=").append(ref);
+ sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
sb.append('}');
return sb.toString();
}
+ // use schema.getContains or content.mediaType.schema.getContains instead of this
+ @Override
+ public CodegenProperty getContains() {
+ return null;
+ }
+
+ // use schema.setContains or content.mediaType.schema.setContains instead of this
+ @Override
+ public void setContains(CodegenProperty contains) {}
+
+ // use schema.getDependentRequired or content.mediaType.schema.getDependentRequired instead of this
+ @Override
+ public LinkedHashMap> getDependentRequired() {
+ return null;
+ }
+
+ // use schema.setDependentRequired or content.mediaType.schema.setDependentRequired instead of this
+ @Override
+ public void setDependentRequired(LinkedHashMap> dependentRequired) {}
+
+ // use schema.getIsBooleanSchemaTrue or content.mediaType.schema.getIsBooleanSchemaTrue instead of this
+ @Override
+ public boolean getIsBooleanSchemaTrue() {
+ return false;
+ }
+
+ // use schema.setIsBooleanSchemaTrue or content.mediaType.schema.setIsBooleanSchemaTrue instead of this
+ @Override
+ public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {}
+
+ // use schema.getIsBooleanSchemaFalse or content.mediaType.schema.getIsBooleanSchemaFalse instead of this
+ @Override
+ public boolean getIsBooleanSchemaFalse() {
+ return false;
+ }
+
+ // use schema.setIsBooleanSchemaFalse or content.mediaType.schema.setIsBooleanSchemaFalse instead of this
+ @Override
+ public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {}
+
+ // use schema.getFormat or content.mediaType.schema.getFormat instead of this
+ @Override
+ public String getFormat() {
+ return null;
+ }
+
+ // use schema.setFormat or content.mediaType.schema.setFormat instead of this
+ @Override
+ public void setFormat(String format) {}
+
@Override
public String getPattern() {
return pattern;
@@ -519,6 +593,16 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
this.uniqueItems = uniqueItems;
}
+ @Override
+ public Boolean getUniqueItemsBoolean() {
+ return uniqueItemsBoolean;
+ }
+
+ @Override
+ public void setUniqueItemsBoolean(Boolean uniqueItemsBoolean) {
+ this.uniqueItemsBoolean = uniqueItemsBoolean;
+ }
+
@Override
public Integer getMinProperties() {
return minProperties;
@@ -815,5 +899,27 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public String getBaseType() {
return baseType;
}
+
+ @Override
+ public Map getRequiredVarsMap() { return requiredVarsMap; }
+
+ @Override
+ public void setRequiredVarsMap(Map requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; }
+
+ @Override
+ public String getRef() { return ref; }
+
+ @Override
+ public void setRef(String ref) { this.ref=ref; }
+
+ @Override
+ public boolean getSchemaIsFromAdditionalProperties() {
+ return schemaIsFromAdditionalProperties;
+ }
+
+ @Override
+ public void setSchemaIsFromAdditionalProperties(boolean schemaIsFromAdditionalProperties) {
+ this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
index 56aee00ce3b..e5fe46954bf 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
@@ -149,6 +149,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isArray;
public boolean isMap;
public boolean isEnum;
+ public boolean isInnerEnum; // Enums declared inline will be located inside the generic model, changing how the enum is referenced in some cases.
public boolean isReadOnly;
public boolean isWriteOnly;
public boolean isNullable;
@@ -180,6 +181,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private Integer maxProperties;
private Integer minProperties;
private boolean uniqueItems;
+ private Boolean uniqueItemsBoolean;
// XML
public boolean isXmlAttribute = false;
@@ -193,6 +195,60 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas = null;
private boolean hasMultipleTypes = false;
+ private Map requiredVarsMap;
+ private String ref;
+ private boolean schemaIsFromAdditionalProperties;
+ private boolean isBooleanSchemaTrue;
+ private boolean isBooleanSchemaFalse;
+ private String format;
+ private LinkedHashMap> dependentRequired;
+ private CodegenProperty contains;
+
+ @Override
+ public CodegenProperty getContains() {
+ return contains;
+ }
+
+ @Override
+ public void setContains(CodegenProperty contains) {
+ this.contains = contains;
+ }
+
+ @Override
+ public LinkedHashMap> getDependentRequired() {
+ return dependentRequired;
+ }
+
+ @Override
+ public void setDependentRequired(LinkedHashMap> dependentRequired) {
+ this.dependentRequired = dependentRequired;
+ }
+
+ @Override
+ public void setFormat(String format) { this.format = format; }
+
+ @Override
+ public String getFormat() { return format; }
+
+ @Override
+ public boolean getIsBooleanSchemaTrue() {
+ return isBooleanSchemaTrue;
+ }
+
+ @Override
+ public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {
+ this.isBooleanSchemaTrue = true;
+ }
+
+ @Override
+ public boolean getIsBooleanSchemaFalse() {
+ return isBooleanSchemaFalse;
+ }
+
+ @Override
+ public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {
+ this.isBooleanSchemaFalse = isBooleanSchemaFalse;
+ }
public String getBaseName() {
return baseName;
@@ -340,6 +396,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.unescapedDescription = unescapedDescription;
}
+ @Override
+ public boolean getSchemaIsFromAdditionalProperties() {
+ return schemaIsFromAdditionalProperties;
+ }
+
+ @Override
+ public void setSchemaIsFromAdditionalProperties(boolean schemaIsFromAdditionalProperties) {
+ this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
+ }
+
@Override
public Integer getMaxLength() {
return maxLength;
@@ -658,6 +724,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
return composedSchemas;
}
+ @Override
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ @Override
+ public String getRef() {
+ return ref;
+ }
+
@Override
public CodegenProperty clone() {
try {
@@ -689,6 +765,21 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
if (this.composedSchemas != null) {
cp.composedSchemas = this.composedSchemas;
}
+ if (this.requiredVarsMap != null) {
+ cp.setRequiredVarsMap(this.requiredVarsMap);
+ }
+ if (this.ref != null) {
+ cp.setRef(this.ref);
+ }
+ if (this.format != null) {
+ cp.setFormat(this.format);
+ }
+ if (this.dependentRequired != null) {
+ cp.setDependentRequired(this.dependentRequired);
+ }
+ if (this.contains != null) {
+ cp.setContains(this.contains);
+ }
return cp;
} catch (CloneNotSupportedException e) {
@@ -706,6 +797,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.uniqueItems = uniqueItems;
}
+ @Override
+ public Boolean getUniqueItemsBoolean() {
+ return uniqueItemsBoolean;
+ }
+
+ @Override
+ public void setUniqueItemsBoolean(Boolean uniqueItemsBoolean) {
+ this.uniqueItemsBoolean = uniqueItemsBoolean;
+ }
+
@Override
public Integer getMinProperties() {
return minProperties;
@@ -866,6 +967,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public void setIsUuid(boolean isUuid) { this.isUuid = isUuid; }
+ @Override
+ public Map getRequiredVarsMap() { return requiredVarsMap; }
+
+ @Override
+ public void setRequiredVarsMap(Map requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@@ -925,6 +1032,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", isArray=").append(isArray);
sb.append(", isMap=").append(isMap);
sb.append(", isEnum=").append(isEnum);
+ sb.append(", isInnerEnum=").append(isInnerEnum);
sb.append(", isAnyType=").append(isAnyType);
sb.append(", isReadOnly=").append(isReadOnly);
sb.append(", isWriteOnly=").append(isWriteOnly);
@@ -951,6 +1059,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", maxProperties=").append(maxProperties);
sb.append(", minProperties=").append(minProperties);
sb.append(", uniqueItems=").append(uniqueItems);
+ sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
sb.append(", multipleOf=").append(multipleOf);
sb.append(", isXmlAttribute=").append(isXmlAttribute);
sb.append(", xmlPrefix='").append(xmlPrefix).append('\'');
@@ -964,6 +1073,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
+ sb.append(", requiredVarsMap=").append(requiredVarsMap);
+ sb.append(", ref=").append(ref);
+ sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
+ sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
+ sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
+ sb.append(", format=").append(format);
+ sb.append(", dependentRequired=").append(dependentRequired);
+ sb.append(", contains=").append(contains);
sb.append('}');
return sb.toString();
}
@@ -1004,6 +1121,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isArray == that.isArray &&
isMap == that.isMap &&
isEnum == that.isEnum &&
+ isInnerEnum == that.isInnerEnum &&
isAnyType == that.isAnyType &&
isReadOnly == that.isReadOnly &&
isWriteOnly == that.isWriteOnly &&
@@ -1018,9 +1136,18 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isNull == that.isNull &&
hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
+ isBooleanSchemaTrue == that.getIsBooleanSchemaTrue() &&
+ isBooleanSchemaFalse == that.getIsBooleanSchemaFalse() &&
+ getSchemaIsFromAdditionalProperties() == that.getSchemaIsFromAdditionalProperties() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
+ Objects.equals(contains, that.getContains()) &&
+ Objects.equals(dependentRequired, that.getDependentRequired()) &&
+ Objects.equals(format, that.getFormat()) &&
+ Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
+ Objects.equals(ref, that.getRef()) &&
+ Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
@@ -1078,12 +1205,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric,
isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isFile,
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,
- isArray, isMap, isEnum, isAnyType, isReadOnly, isWriteOnly, isNullable, isShort,
+ isArray, isMap, isEnum, isInnerEnum, isAnyType, isReadOnly, isWriteOnly, isNullable, isShort,
isUnboundedInteger, isSelfReference, isCircularReference, isDiscriminator, _enum,
allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars,
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
+ ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
+ format, dependentRequired, contains);
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
index f27d5bb13aa..aa6b103b77c 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
@@ -67,6 +67,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private Integer maxProperties;
private Integer minProperties;
private boolean uniqueItems;
+ private Boolean uniqueItemsBoolean;
private Integer maxItems;
private Integer minItems;
private Integer maxLength;
@@ -89,6 +90,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
private LinkedHashMap content;
+ private Map requiredVarsMap;
+ private String ref;
+ private boolean schemaIsFromAdditionalProperties;
@Override
public int hashCode() {
@@ -100,7 +104,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
- hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content);
+ hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content,
+ requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
}
@Override
@@ -146,9 +151,13 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
is5xx == that.is5xx &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
hasMultipleTypes == that.getHasMultipleTypes() &&
+ getSchemaIsFromAdditionalProperties() == that.getSchemaIsFromAdditionalProperties() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
+ Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
+ Objects.equals(ref, that.getRef()) &&
+ Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(content, that.getContent()) &&
Objects.equals(responseHeaders, that.getResponseHeaders()) &&
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
@@ -180,6 +189,56 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
}
+ // use content.mediaType.schema.getContains instead of this
+ @Override
+ public CodegenProperty getContains() {
+ return null;
+ }
+
+ // use content.mediaType.schema.setContains instead of this
+ @Override
+ public void setContains(CodegenProperty contains) {}
+
+ // use content.mediaType.schema.getDependentRequired instead of this
+ @Override
+ public LinkedHashMap> getDependentRequired() {
+ return null;
+ }
+
+ // use content.mediaType.schema.setDependentRequired instead of this
+ @Override
+ public void setDependentRequired(LinkedHashMap> dependentRequired) {}
+
+ // use content.mediaType.schema.getIsBooleanSchemaTrue instead of this
+ @Override
+ public boolean getIsBooleanSchemaTrue() {
+ return false;
+ }
+
+ // use content.mediaType.schema.setIsBooleanSchemaTrue instead of this
+ @Override
+ public void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue) {}
+
+ // use content.mediaType.schema.getIsBooleanSchemaFalse instead of this
+ @Override
+ public boolean getIsBooleanSchemaFalse() {
+ return false;
+ }
+
+ // use content.mediaType.schema.setIsBooleanSchemaFalse instead of this
+ @Override
+ public void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse) {}
+
+ // use content.mediaType.schema.getFormat instead of this
+ @Override
+ public String getFormat() {
+ return null;
+ }
+
+ // use content.mediaType.schema.setFormat instead of this
+ @Override
+ public void setFormat(String format) {}
+
public LinkedHashMap getContent() {
return content;
}
@@ -296,6 +355,17 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
this.uniqueItems = uniqueItems;
}
+ @Override
+ public Boolean getUniqueItemsBoolean() {
+ return uniqueItemsBoolean;
+ }
+
+ @Override
+ public void setUniqueItemsBoolean(Boolean uniqueItemsBoolean) {
+ this.uniqueItemsBoolean = uniqueItemsBoolean;
+ }
+
+
@Override
public Integer getMinProperties() {
return minProperties;
@@ -514,6 +584,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", maxProperties=").append(maxProperties);
sb.append(", minProperties=").append(minProperties);
sb.append(", uniqueItems=").append(uniqueItems);
+ sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
sb.append(", maxItems=").append(maxItems);
sb.append(", minItems=").append(minItems);
sb.append(", maxLength=").append(maxLength);
@@ -538,6 +609,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", responseHeaders=").append(responseHeaders);
sb.append(", content=").append(content);
+ sb.append(", requiredVarsMap=").append(requiredVarsMap);
+ sb.append(", ref=").append(ref);
+ sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
sb.append('}');
return sb.toString();
}
@@ -665,4 +739,26 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public String getBaseType() {
return baseType;
}
+
+ @Override
+ public Map getRequiredVarsMap() { return requiredVarsMap; }
+
+ @Override
+ public void setRequiredVarsMap(Map requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; }
+
+ @Override
+ public String getRef() { return ref; }
+
+ @Override
+ public void setRef(String ref) { this.ref=ref; }
+
+ @Override
+ public boolean getSchemaIsFromAdditionalProperties() {
+ return schemaIsFromAdditionalProperties;
+ }
+
+ @Override
+ public void setSchemaIsFromAdditionalProperties(boolean schemaIsFromAdditionalProperties) {
+ this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
index cc015079a4d..d6eef2a4222 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
@@ -79,6 +79,7 @@ import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariable;
import io.swagger.v3.parser.util.SchemaTypeUtil;
+import static org.openapitools.codegen.CodegenConstants.UNSUPPORTED_V310_SPEC_MSG;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.*;
@@ -90,6 +91,10 @@ public class DefaultCodegen implements CodegenConfig {
// A cache of sanitized words. The sanitizeName() method is invoked many times with the same
// arguments, this cache is used to optimized performance.
private static Cache sanitizedNameCache;
+ private static final String xSchemaTestExamplesKey = "x-schema-test-examples";
+ private static final String xSchemaTestExamplesRefPrefix = "#/components/x-schema-test-examples/";
+ protected static Schema falseSchema;
+ protected static Schema trueSchema = new Schema();
static {
DefaultFeatureSet = FeatureSet.newBuilder()
@@ -142,6 +147,8 @@ public class DefaultCodegen implements CodegenConfig {
.expireAfterAccess(cacheExpiry, TimeUnit.SECONDS)
.ticker(Ticker.systemTicker())
.build();
+ falseSchema = new Schema();
+ falseSchema.setNot(new Schema());
}
protected GeneratorMetadata generatorMetadata;
@@ -149,6 +156,7 @@ public class DefaultCodegen implements CodegenConfig {
protected String outputFolder = "";
protected Set defaultIncludes;
protected Map typeMapping;
+ // instantiationTypes map from container types only: set, map, and array to the in language-type
protected Map instantiationTypes;
protected Set reservedWords;
protected Set languageSpecificPrimitives = new HashSet<>();
@@ -279,6 +287,22 @@ public class DefaultCodegen implements CodegenConfig {
protected boolean loadDeepObjectIntoItems = true;
+ // if true then baseTypes will be imported
+ protected boolean importBaseType = true;
+
+ // if true then container types will be imported
+ protected boolean importContainerType = true;
+
+ // if True codegenParameter and codegenResponse imports will come
+ // from deeper schema defined locations
+ protected boolean addSchemaImportsFromV3SpecLocations = false;
+
+ protected boolean addSuffixToDuplicateOperationNicknames = true;
+
+ public boolean getAddSuffixToDuplicateOperationNicknames() {
+ return addSuffixToDuplicateOperationNicknames;
+ }
+
@Override
public List cliOptions() {
return cliOptions;
@@ -286,6 +310,7 @@ public class DefaultCodegen implements CodegenConfig {
@Override
public void processOpts() {
+
if (additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR)) {
this.setTemplateDir((String) additionalProperties.get(CodegenConstants.TEMPLATE_DIR));
}
@@ -802,6 +827,19 @@ public class DefaultCodegen implements CodegenConfig {
*/
@Override
public void setOpenAPI(OpenAPI openAPI) {
+ String originalSpecVersion;
+ String xOriginalSwaggerVersion = "x-original-swagger-version";
+ if (openAPI.getExtensions() != null && !openAPI.getExtensions().isEmpty() && openAPI.getExtensions().containsValue(xOriginalSwaggerVersion)) {
+ originalSpecVersion = (String) openAPI.getExtensions().get(xOriginalSwaggerVersion);
+ } else {
+ originalSpecVersion = openAPI.getOpenapi();
+ }
+ Integer specMajorVersion = Integer.parseInt(originalSpecVersion.substring(0, 1));
+ Integer specMinorVersion = Integer.parseInt(originalSpecVersion.substring(2, 3));
+ boolean specVersionGreaterThanOrEqualTo310 = (specMajorVersion == 3 && specMinorVersion >= 1);
+ if (specVersionGreaterThanOrEqualTo310) {
+ LOGGER.warn(UNSUPPORTED_V310_SPEC_MSG);
+ }
this.openAPI = openAPI;
// Set global settings such that helper functions in ModelUtils can lookup the value
// of the CLI option.
@@ -2456,15 +2494,17 @@ public class DefaultCodegen implements CodegenConfig {
}
private static class NamedSchema {
- private NamedSchema(String name, Schema s, boolean required) {
+ private NamedSchema(String name, Schema s, boolean required, boolean schemaIsFromAdditionalProperties) {
this.name = name;
this.schema = s;
this.required = required;
+ this.schemaIsFromAdditionalProperties = schemaIsFromAdditionalProperties;
}
private String name;
private Schema schema;
private boolean required;
+ private boolean schemaIsFromAdditionalProperties;
@Override
public boolean equals(Object o) {
@@ -2473,12 +2513,13 @@ public class DefaultCodegen implements CodegenConfig {
NamedSchema that = (NamedSchema) o;
return Objects.equals(required, that.required) &&
Objects.equals(name, that.name) &&
- Objects.equals(schema, that.schema);
+ Objects.equals(schema, that.schema) &&
+ Objects.equals(schemaIsFromAdditionalProperties, that.schemaIsFromAdditionalProperties);
}
@Override
public int hashCode() {
- return Objects.hash(name, schema, required);
+ return Objects.hash(name, schema, required, schemaIsFromAdditionalProperties);
}
}
@@ -2690,6 +2731,7 @@ public class DefaultCodegen implements CodegenConfig {
}
// process 'additionalProperties'
setAddProps(schema, m);
+ addRequiredVarsMap(schema, m);
}
protected void updateModelForAnyType(CodegenModel m, Schema schema) {
@@ -2710,6 +2752,7 @@ public class DefaultCodegen implements CodegenConfig {
}
// process 'additionalProperties'
setAddProps(schema, m);
+ addRequiredVarsMap(schema, m);
}
protected String toTestCaseName(String specTestCaseName) {
@@ -2729,17 +2772,20 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Processes any test cases if they exist in the components.x-test-examples vendor extensions
* If they exist then cast them to java class instances and return them back in a map
- * @param schemaName the component schema name that the test cases are for
- * @param vendorExtensions the extensions that may or may not hold the data
+ * @param refToTestCases the component schema name that the test cases are for
*/
- private HashMap extractSchemaTestCases(String schemaName, HashMap vendorExtensions) {
- String testExamplesKey = "x-schema-test-examples";
+ private HashMap extractSchemaTestCases(String refToTestCases) {
// schemaName to a map of test case name to test case
- if (vendorExtensions == null || !vendorExtensions.containsKey(testExamplesKey)) {
+ HashMap vendorExtensions = (HashMap) openAPI.getComponents().getExtensions();
+ if (vendorExtensions == null || !vendorExtensions.containsKey(xSchemaTestExamplesKey)) {
return null;
}
+ if (!refToTestCases.startsWith(xSchemaTestExamplesRefPrefix)) {
+ return null;
+ }
+ String schemaName = refToTestCases.substring(xSchemaTestExamplesRefPrefix.length());
HashMap schemaTestCases = new HashMap<>();
- LinkedHashMap schemaNameToTestCases = (LinkedHashMap) vendorExtensions.get(testExamplesKey);
+ LinkedHashMap schemaNameToTestCases = (LinkedHashMap) vendorExtensions.get(xSchemaTestExamplesKey);
if (!schemaNameToTestCases.containsKey(schemaName)) {
return null;
@@ -2759,6 +2805,52 @@ public class DefaultCodegen implements CodegenConfig {
return schemaTestCases;
}
+ /**
+ * Sets the booleans that define the model's type
+ *
+ * @param model the model to update
+ * @param schema the model's schema
+ */
+ protected void updateModelForString(CodegenModel model, Schema schema) {
+ // NOTE: String schemas as CodegenModel is a rare use case and may be removed at a later date.
+ if (ModelUtils.isDateTimeSchema(schema)) {
+ // NOTE: DateTime schemas as CodegenModel is a rare use case and may be removed at a later date.
+ model.setIsString(false); // for backward compatibility with 2.x
+ model.isDateTime = Boolean.TRUE;
+ } else if (ModelUtils.isDateSchema(schema)) {
+ // NOTE: Date schemas as CodegenModel is a rare use case and may be removed at a later date.
+ model.setIsString(false); // for backward compatibility with 2.x
+ model.isDate = Boolean.TRUE;
+ } else if (ModelUtils.isUUIDSchema(schema)) {
+ // NOTE: UUID schemas as CodegenModel is a rare use case and may be removed at a later date.
+ model.setIsString(false);
+ model.setIsUuid(true);
+ }
+ }
+
+ protected void updateModelForNumber(CodegenModel model, Schema schema) {
+ // NOTE: Number schemas as CodegenModel is a rare use case and may be removed at a later date.
+ model.isNumeric = Boolean.TRUE;
+ if (ModelUtils.isFloatSchema(schema)) { // float
+ model.isFloat = Boolean.TRUE;
+ } else if (ModelUtils.isDoubleSchema(schema)) { // double
+ model.isDouble = Boolean.TRUE;
+ }
+ }
+
+ protected void updateModelForInteger(CodegenModel model, Schema schema) {
+ // NOTE: Integral schemas as CodegenModel is a rare use case and may be removed at a later date.
+ model.isNumeric = Boolean.TRUE;
+ if (ModelUtils.isLongSchema(schema)) { // int64/long format
+ model.isLong = Boolean.TRUE;
+ } else {
+ model.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
+ if (ModelUtils.isShortSchema(schema)) { // int32
+ model.setIsShort(Boolean.TRUE);
+ }
+ }
+ }
+
/**
* Convert OAS Model object to Codegen Model object.
*
@@ -2774,6 +2866,12 @@ public class DefaultCodegen implements CodegenConfig {
typeAliases = getAllAliases(allDefinitions);
}
+ CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
+ if (schema.equals(trueSchema)) {
+ m.setIsBooleanSchemaTrue(true);
+ } else if (schema.equals(falseSchema)) {
+ m.setIsBooleanSchemaFalse(true);
+ }
// unalias schema
schema = unaliasSchema(schema);
if (schema == null) {
@@ -2781,11 +2879,9 @@ public class DefaultCodegen implements CodegenConfig {
return null;
}
- CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
ModelUtils.syncValidationProperties(schema, m);
if (openAPI != null) {
- HashMap vendorExtensions = (HashMap) openAPI.getComponents().getExtensions();
- HashMap schemaTestCases = extractSchemaTestCases(name, vendorExtensions);
+ HashMap schemaTestCases = extractSchemaTestCases(xSchemaTestExamplesRefPrefix + name);
m.testCases = schemaTestCases;
}
@@ -2836,6 +2932,7 @@ public class DefaultCodegen implements CodegenConfig {
}
m.setTypeProperties(schema);
+ m.setFormat(schema.getFormat());
m.setComposedSchemas(getComposedSchemas(schema));
if (ModelUtils.isArraySchema(schema)) {
CodegenProperty arrayProperty = fromProperty(name, schema, false);
@@ -2843,39 +2940,11 @@ public class DefaultCodegen implements CodegenConfig {
m.arrayModelType = arrayProperty.complexType;
addParentContainer(m, name, schema);
} else if (ModelUtils.isIntegerSchema(schema)) { // integer type
- // NOTE: Integral schemas as CodegenModel is a rare use case and may be removed at a later date.
- m.isNumeric = Boolean.TRUE;
- if (ModelUtils.isLongSchema(schema)) { // int64/long format
- m.isLong = Boolean.TRUE;
- } else {
- m.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
- if (ModelUtils.isShortSchema(schema)) { // int32
- m.setIsShort(Boolean.TRUE);
- }
- }
+ updateModelForInteger(m, schema);
} else if (ModelUtils.isStringSchema(schema)) {
- // NOTE: String schemas as CodegenModel is a rare use case and may be removed at a later date.
- if (ModelUtils.isDateTimeSchema(schema)) {
- // NOTE: DateTime schemas as CodegenModel is a rare use case and may be removed at a later date.
- m.setIsString(false); // for backward compatibility with 2.x
- m.isDateTime = Boolean.TRUE;
- } else if (ModelUtils.isDateSchema(schema)) {
- // NOTE: Date schemas as CodegenModel is a rare use case and may be removed at a later date.
- m.setIsString(false); // for backward compatibility with 2.x
- m.isDate = Boolean.TRUE;
- } else if (ModelUtils.isUUIDSchema(schema)) {
- // NOTE: UUID schemas as CodegenModel is a rare use case and may be removed at a later date.
- m.setIsString(false);
- m.setIsUuid(true);
- }
+ updateModelForString(m, schema);
} else if (ModelUtils.isNumberSchema(schema)) {
- // NOTE: Number schemas as CodegenModel is a rare use case and may be removed at a later date.
- m.isNumeric = Boolean.TRUE;
- if (ModelUtils.isFloatSchema(schema)) { // float
- m.isFloat = Boolean.TRUE;
- } else if (ModelUtils.isDoubleSchema(schema)) { // double
- m.isDouble = Boolean.TRUE;
- }
+ updateModelForNumber(m, schema);
} else if (ModelUtils.isAnyType(schema)) {
updateModelForAnyType(m, schema);
} else if (ModelUtils.isTypeObjectSchema(schema)) {
@@ -2886,6 +2955,9 @@ public class DefaultCodegen implements CodegenConfig {
// schema by unaliasSchema and one of the above code paths will be taken
;
}
+ if (schema.get$ref() != null) {
+ m.setRef(schema.get$ref());
+ }
if (schema instanceof ComposedSchema) {
updateModelForComposedSchema(m, schema, allDefinitions);
@@ -2940,6 +3012,9 @@ public class DefaultCodegen implements CodegenConfig {
}
}
+ if (addSchemaImportsFromV3SpecLocations) {
+ addImports(m.imports, m.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
+ }
return m;
}
@@ -3309,8 +3384,19 @@ public class DefaultCodegen implements CodegenConfig {
discriminator.setPropertyName(toVarName(discPropName));
discriminator.setPropertyBaseName(sourceDiscriminator.getPropertyName());
discriminator.setPropertyGetter(toGetter(discriminator.getPropertyName()));
+
// FIXME: for now, we assume that the discriminator property is String
discriminator.setPropertyType(typeMapping.get("string"));
+
+ // check to see if the discriminator property is an enum string
+ if (schema.getProperties() != null &&
+ schema.getProperties().get(discPropName) instanceof StringSchema) {
+ StringSchema s = (StringSchema) schema.getProperties().get(discPropName);
+ if (s.getEnum() != null && !s.getEnum().isEmpty()) { // it's an enum string
+ discriminator.setIsEnum(true);
+ }
+ }
+
discriminator.setMapping(sourceDiscriminator.getMapping());
List uniqueDescendants = new ArrayList<>();
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
@@ -3486,7 +3572,10 @@ public class DefaultCodegen implements CodegenConfig {
if (Boolean.FALSE.equals(p.getNullable())) {
LOGGER.warn("Schema '{}' is any type, which includes the 'null' value. 'nullable' cannot be set to 'false'", p.getName());
}
- property.isNullable = true;
+ ComposedSchema composedSchema = p instanceof ComposedSchema
+ ? (ComposedSchema) p
+ : null;
+ property.isNullable = property.isNullable || composedSchema == null || composedSchema.getAllOf() == null || composedSchema.getAllOf().size() == 0;
if (languageSpecificPrimitives.contains(property.dataType)) {
property.isPrimitiveType = true;
}
@@ -3525,6 +3614,42 @@ public class DefaultCodegen implements CodegenConfig {
property.pattern = toRegularExpression(p.getPattern());
}
+ protected void updatePropertyForNumber(CodegenProperty property, Schema p) {
+ property.isNumeric = Boolean.TRUE;
+ if (ModelUtils.isFloatSchema(p)) { // float
+ property.isFloat = Boolean.TRUE;
+ } else if (ModelUtils.isDoubleSchema(p)) { // double
+ property.isDouble = Boolean.TRUE;
+ }
+ }
+
+ protected void updatePropertyForInteger(CodegenProperty property, Schema p) {
+ property.isNumeric = Boolean.TRUE;
+ if (ModelUtils.isLongSchema(p)) { // int64/long format
+ property.isLong = Boolean.TRUE;
+ } else {
+ property.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
+ if (ModelUtils.isShortSchema(p)) { // int32
+ property.setIsShort(Boolean.TRUE);
+ }
+ }
+ }
+
+ /**
+ * TODO remove this in 7.0.0 as a breaking change
+ * This method was kept when required was added to the fromProperty signature
+ * to ensure that the change was non-breaking
+ *
+ * @param name name of the property
+ * @param p OAS property schema
+ * @param required true if the property is required in the next higher object schema, false otherwise
+ * @return Codegen Property object
+ */
+ public CodegenProperty fromProperty(String name, Schema p, boolean required) {
+ return fromProperty(name, p, required, false);
+ }
+
+
/**
* TODO remove this in 7.0.0 as a breaking change
* This method was kept when required was added to the fromProperty signature
@@ -3535,7 +3660,7 @@ public class DefaultCodegen implements CodegenConfig {
* @return Codegen Property object
*/
public CodegenProperty fromProperty(String name, Schema p) {
- return fromProperty(name, p, false);
+ return fromProperty(name, p, false, false);
}
/**
@@ -3550,26 +3675,38 @@ public class DefaultCodegen implements CodegenConfig {
* @param name name of the property
* @param p OAS property schema
* @param required true if the property is required in the next higher object schema, false otherwise
+ * @param schemaIsFromAdditionalProperties true if the property is a required property defined by additional properties schema
+ * If this is the actual additionalProperties schema not defining a required property, then
+ * the value should be false
* @return Codegen Property object
*/
- public CodegenProperty fromProperty(String name, Schema p, boolean required) {
+ public CodegenProperty fromProperty(String name, Schema p, boolean required, boolean schemaIsFromAdditionalProperties) {
if (p == null) {
LOGGER.error("Undefined property/schema for `{}`. Default to type:string.", name);
return null;
}
LOGGER.debug("debugging fromProperty for {} : {}", name, p);
- NamedSchema ns = new NamedSchema(name, p, required);
+ NamedSchema ns = new NamedSchema(name, p, required, schemaIsFromAdditionalProperties);
CodegenProperty cpc = schemaCodegenPropertyCache.get(ns);
if (cpc != null) {
LOGGER.debug("Cached fromProperty for {} : {} required={}", name, p.getName(), required);
return cpc;
}
+
+ CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
+ if (p.equals(trueSchema)) {
+ property.setIsBooleanSchemaTrue(true);
+ } else if (p.equals(falseSchema)) {
+ property.setIsBooleanSchemaFalse(true);
+ }
+
// unalias schema
p = unaliasSchema(p);
- CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
+ property.setSchemaIsFromAdditionalProperties(schemaIsFromAdditionalProperties);
property.required = required;
ModelUtils.syncValidationProperties(p, property);
+ property.setFormat(p.getFormat());
property.name = toVarName(name);
property.baseName = name;
@@ -3646,6 +3783,7 @@ public class DefaultCodegen implements CodegenConfig {
property._enum.add(String.valueOf(i));
}
property.isEnum = true;
+ property.isInnerEnum = true;
Map allowableValues = new HashMap<>();
allowableValues.put("values", _enum);
@@ -3686,15 +3824,7 @@ public class DefaultCodegen implements CodegenConfig {
property.setTypeProperties(p);
property.setComposedSchemas(getComposedSchemas(p));
if (ModelUtils.isIntegerSchema(p)) { // integer type
- property.isNumeric = Boolean.TRUE;
- if (ModelUtils.isLongSchema(p)) { // int64/long format
- property.isLong = Boolean.TRUE;
- } else {
- property.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
- if (ModelUtils.isShortSchema(p)) { // int32
- property.setIsShort(Boolean.TRUE);
- }
- }
+ updatePropertyForInteger(property, p);
} else if (ModelUtils.isBooleanSchema(p)) { // boolean type
property.getter = toBooleanGetter(name);
} else if (ModelUtils.isFileSchema(p) && !ModelUtils.isStringSchema(p)) {
@@ -3703,12 +3833,7 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isStringSchema(p)) {
updatePropertyForString(property, p);
} else if (ModelUtils.isNumberSchema(p)) {
- property.isNumeric = Boolean.TRUE;
- if (ModelUtils.isFloatSchema(p)) { // float
- property.isFloat = Boolean.TRUE;
- } else if (ModelUtils.isDoubleSchema(p)) { // double
- property.isDouble = Boolean.TRUE;
- }
+ updatePropertyForNumber(property, p);
} else if (ModelUtils.isArraySchema(p)) {
// default to string if inner item is undefined
property.isContainer = true;
@@ -3745,6 +3870,9 @@ public class DefaultCodegen implements CodegenConfig {
// referenced model
;
}
+ if (p.get$ref() != null) {
+ property.setRef(p.get$ref());
+ }
boolean isAnyTypeWithNothingElseSet = (ModelUtils.isAnyType(p) &&
(p.getProperties() == null || p.getProperties().isEmpty()) &&
@@ -3791,6 +3919,7 @@ public class DefaultCodegen implements CodegenConfig {
// isEnum is set to true when the type is an enum
// or the inner type of an array/map is an enum
property.isEnum = true;
+ property.isInnerEnum = true;
// update datatypeWithEnum and default value for array
// e.g. List => List
updateDataTypeWithEnumForArray(property);
@@ -3827,6 +3956,7 @@ public class DefaultCodegen implements CodegenConfig {
// isEnum is set to true when the type is an enum
// or the inner type of an array/map is an enum
property.isEnum = true;
+ property.isInnerEnum = true;
// update datatypeWithEnum and default value for map
// e.g. Dictionary => Dictionary
updateDataTypeWithEnumForMap(property);
@@ -4144,14 +4274,16 @@ public class DefaultCodegen implements CodegenConfig {
String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code);
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
- if (r.baseType != null &&
- !defaultIncludes.contains(r.baseType) &&
- !languageSpecificPrimitives.contains(r.baseType)) {
- imports.add(r.baseType);
- }
- if ("set".equals(r.containerType) && typeMapping.containsKey(r.containerType)) {
- op.uniqueItems = true;
- imports.add(typeMapping.get(r.containerType));
+ if (!addSchemaImportsFromV3SpecLocations) {
+ if (r.baseType != null &&
+ !defaultIncludes.contains(r.baseType) &&
+ !languageSpecificPrimitives.contains(r.baseType)) {
+ imports.add(r.baseType);
+ }
+ if ("set".equals(r.containerType) && typeMapping.containsKey(r.containerType)) {
+ op.uniqueItems = true;
+ imports.add(typeMapping.get(r.containerType));
+ }
}
op.responses.add(r);
@@ -4161,6 +4293,9 @@ public class DefaultCodegen implements CodegenConfig {
if (Boolean.TRUE.equals(r.isFile) && Boolean.TRUE.equals(r.is2xx) && Boolean.FALSE.equals(op.isResponseFile)) {
op.isResponseFile = Boolean.TRUE;
}
+ if (Boolean.TRUE.equals(r.isDefault)) {
+ op.defaultReturnType = Boolean.TRUE;
+ }
// check if any 4xx or 5xx response has an error response object defined
if ((Boolean.TRUE.equals(r.is4xx) || Boolean.TRUE.equals(r.is5xx)) &&
@@ -4637,10 +4772,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.isContainer = true;
codegenParameter.isMap = true;
- // recursively add import
- while (codegenProperty != null) {
- imports.add(codegenProperty.baseType);
- codegenProperty = codegenProperty.items;
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // recursively add import
+ while (codegenProperty != null) {
+ imports.add(codegenProperty.baseType);
+ codegenProperty = codegenProperty.items;
+ }
}
}
@@ -4725,6 +4862,9 @@ public class DefaultCodegen implements CodegenConfig {
prop = fromProperty(parameter.getName(), parameterSchema, false);
}
codegenParameter.setSchema(prop);
+ if (addSchemaImportsFromV3SpecLocations) {
+ addImports(imports, prop.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
+ }
} else if (parameter.getContent() != null) {
Content content = parameter.getContent();
if (content.size() > 1) {
@@ -4758,7 +4898,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter;
}
- // TODO need to reivew replacing empty map with schemaMapping instead
+ // TODO need to review replacing empty map with schemaMapping instead
parameterSchema = unaliasSchema(parameterSchema);
if (parameterSchema == null) {
LOGGER.warn("warning! Schema not found for parameter \" {} \"", parameter.getName());
@@ -4850,11 +4990,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.mostInnerItems = itemsProperty.mostInnerItems;
codegenParameter.baseType = itemsProperty.dataType;
codegenParameter.isContainer = true;
-
- // recursively add import
- while (itemsProperty != null) {
- imports.add(itemsProperty.baseType);
- itemsProperty = itemsProperty.items;
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // recursively add import
+ while (itemsProperty != null) {
+ imports.add(itemsProperty.baseType);
+ itemsProperty = itemsProperty.items;
+ }
}
} else {
// referenced schemas
@@ -4874,25 +5015,30 @@ public class DefaultCodegen implements CodegenConfig {
} else {
codegenParameter.dataType = codegenProperty.dataType;
}
- if (ModelUtils.isSet(parameterSchema)) {
- imports.add(codegenProperty.baseType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ if (ModelUtils.isSet(parameterSchema)) {
+ imports.add(codegenProperty.baseType);
+ }
}
codegenParameter.dataFormat = codegenProperty.dataFormat;
if (parameter.getRequired() != null) {
codegenParameter.required = parameter.getRequired().booleanValue();
}
- if (codegenProperty.isEnum) {
- codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
- codegenParameter.enumName = codegenProperty.enumName;
- }
-
// enum
updateCodegenPropertyEnum(codegenProperty);
codegenParameter.isEnum = codegenProperty.isEnum;
codegenParameter._enum = codegenProperty._enum;
codegenParameter.allowableValues = codegenProperty.allowableValues;
+ if (codegenProperty.isEnum) {
+ codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
+ codegenParameter.enumName = codegenProperty.enumName;
+ if (codegenProperty.defaultValue != null) {
+ codegenParameter.enumDefaultValue = codegenProperty.defaultValue.replace(codegenProperty.enumName + ".", "");
+ }
+ }
+
if (codegenProperty.items != null && codegenProperty.items.isEnum) {
codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
codegenParameter.enumName = codegenProperty.enumName;
@@ -4905,10 +5051,11 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.isCollectionFormatMulti = true;
}
codegenParameter.paramName = toParamName(parameter.getName());
-
- // import
- if (codegenProperty.complexType != null) {
- imports.add(codegenProperty.complexType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // import
+ if (codegenProperty.complexType != null) {
+ imports.add(codegenProperty.complexType);
+ }
}
codegenParameter.pattern = toRegularExpression(parameterSchema.getPattern());
@@ -5279,15 +5426,17 @@ public class DefaultCodegen implements CodegenConfig {
final CodegenProperty property = fromProperty(name, schema, false);
addImport(model, property.complexType);
model.parent = toInstantiationType(schema);
- final String containerType = property.containerType;
- final String instantiationType = instantiationTypes.get(containerType);
- if (instantiationType != null) {
- addImport(model, instantiationType);
- }
+ if (!addSchemaImportsFromV3SpecLocations) {
+ final String containerType = property.containerType;
+ final String instantiationType = instantiationTypes.get(containerType);
+ if (instantiationType != null) {
+ addImport(model, instantiationType);
+ }
- final String mappedType = typeMapping.get(containerType);
- if (mappedType != null) {
- addImport(model, mappedType);
+ final String mappedType = typeMapping.get(containerType);
+ if (mappedType != null) {
+ addImport(model, mappedType);
+ }
}
}
@@ -5318,7 +5467,7 @@ public class DefaultCodegen implements CodegenConfig {
}
protected void addImports(Set importsToBeAddedTo, IJsonSchemaValidationProperties type) {
- addImports(importsToBeAddedTo, type.getImports(true));
+ addImports(importsToBeAddedTo, type.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
}
protected void addImports(Set importsToBeAddedTo, Set importsToAdd) {
@@ -5395,7 +5544,7 @@ public class DefaultCodegen implements CodegenConfig {
if (allProperties != null) {
Set allMandatory = allRequired == null ? Collections.emptySet()
: new TreeSet<>(allRequired);
- // update "vars" with parent's properties (all, required)
+ // update "allVars" with parent's properties (all, required)
addVars(m, m.allVars, allProperties, allMandatory);
m.allMandatory = allMandatory;
} else { // without parent, allVars and vars are the same
@@ -5431,18 +5580,40 @@ public class DefaultCodegen implements CodegenConfig {
if (properties == null) {
return;
}
+
+ HashMap varsMap = new HashMap<>();
CodegenModel cm = null;
if (m instanceof CodegenModel) {
cm = (CodegenModel) m;
- }
- for (Map.Entry entry : properties.entrySet()) {
+ if (cm.allVars == vars) { // processing allVars
+ for (CodegenProperty var : cm.vars) {
+ // create a map of codegen properties for lookup later
+ varsMap.put(var.baseName, var);
+ }
+ }
+ }
+
+ for (Map.Entry entry : properties.entrySet()) {
final String key = entry.getKey();
final Schema prop = entry.getValue();
if (prop == null) {
LOGGER.warn("Please report the issue. There shouldn't be null property for {}", key);
} else {
- final CodegenProperty cp = fromProperty(key, prop, mandatory.contains(key));
+ final CodegenProperty cp;
+
+ if (cm != null && cm.allVars == vars && varsMap.keySet().contains(key)) {
+ // when updating allVars, reuse the codegen property from the child model if it's already present
+ // the goal is to avoid issues when the property is defined in both child, parent but the
+ // definition is not identical, e.g. required vs optional, integer vs string
+ LOGGER.debug("The property `{}` already defined in the child model. Using the one from child.",
+ key);
+ cp = varsMap.get(key);
+ } else {
+ // properties in the parent model only
+ cp = fromProperty(key, prop, mandatory.contains(key));
+ }
+
vars.add(cp);
m.setHasVars(true);
@@ -5465,8 +5636,9 @@ public class DefaultCodegen implements CodegenConfig {
if (!Boolean.TRUE.equals(cp.isReadOnly)) {
cm.hasOnlyReadOnly = false;
}
-
- addImportsForPropertyType(cm, cp);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ addImportsForPropertyType(cm, cp);
+ }
// if required, add to the list "requiredVars"
if (Boolean.FALSE.equals(cp.required)) {
@@ -5499,7 +5671,7 @@ public class DefaultCodegen implements CodegenConfig {
*/
protected void addImportsForPropertyType(CodegenModel model, CodegenProperty property) {
if (property.isArray) {
- if (property.getUniqueItems()) { // set
+ if (Boolean.TRUE.equals(property.getUniqueItemsBoolean())) { // set
addImport(model.imports, typeMapping.get("set"));
} else { // array
addImport(model.imports, typeMapping.get("array"));
@@ -5853,7 +6025,7 @@ public class DefaultCodegen implements CodegenConfig {
for (String lib : supportedLibraries.keySet()) {
sb.append("\n").append(lib).append(" - ").append(supportedLibraries.get(lib));
}
- return new CliOption("library", sb.toString());
+ return new CliOption(CodegenConstants.LIBRARY, sb.toString());
}
/**
@@ -6604,10 +6776,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat;
codegenParameter.isCollectionFormatMulti = "multi".equals(collectionFormat);
- // recursively add import
- while (arrayInnerProperty != null) {
- imports.add(arrayInnerProperty.baseType);
- arrayInnerProperty = arrayInnerProperty.items;
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // recursively add import
+ while (arrayInnerProperty != null) {
+ imports.add(arrayInnerProperty.baseType);
+ arrayInnerProperty = arrayInnerProperty.items;
+ }
}
} else {
// referenced schemas
@@ -6633,13 +6807,17 @@ public class DefaultCodegen implements CodegenConfig {
if (codegenProperty.isEnum) {
codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
codegenParameter.enumName = codegenProperty.enumName;
+ if (codegenProperty.defaultValue != null) {
+ codegenParameter.enumDefaultValue = codegenProperty.defaultValue.replace(codegenProperty.enumName + ".", "");
+ }
}
- // import
- if (codegenProperty.complexType != null) {
- imports.add(codegenProperty.complexType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // import
+ if (codegenProperty.complexType != null) {
+ imports.add(codegenProperty.complexType);
+ }
}
-
setParameterExampleValue(codegenParameter);
// set nullable
setParameterNullable(codegenParameter, codegenProperty);
@@ -6668,13 +6846,18 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.dataType = getTypeDeclaration(codegenModel.classname);
codegenParameter.description = codegenModel.description;
codegenParameter.isNullable = codegenModel.isNullable;
- imports.add(codegenParameter.baseType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ imports.add(codegenParameter.baseType);
+ }
} else {
CodegenProperty codegenProperty = fromProperty("property", schema, false);
if (codegenProperty != null && codegenProperty.getComplexType() != null && codegenProperty.getComplexType().contains(" | ")) {
- List parts = Arrays.asList(codegenProperty.getComplexType().split(" \\| "));
- imports.addAll(parts);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ // TODO move this splitting logic to the generator that needs it only
+ List parts = Arrays.asList(codegenProperty.getComplexType().split(" \\| "));
+ imports.addAll(parts);
+ }
String codegenModelName = codegenProperty.getComplexType();
codegenParameter.baseName = codegenModelName;
codegenParameter.paramName = toParamName(codegenParameter.baseName);
@@ -6712,10 +6895,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.baseType = codegenModelName;
codegenParameter.dataType = getTypeDeclaration(codegenModelName);
codegenParameter.description = codegenModelDescription;
- imports.add(codegenParameter.baseType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ imports.add(codegenParameter.baseType);
- if (codegenProperty.complexType != null) {
- imports.add(codegenProperty.complexType);
+ if (codegenProperty.complexType != null) {
+ imports.add(codegenProperty.complexType);
+ }
}
}
}
@@ -6737,14 +6922,15 @@ public class DefaultCodegen implements CodegenConfig {
}
CodegenProperty codegenProperty = fromProperty("property", schema, false);
- imports.add(codegenProperty.baseType);
-
- CodegenProperty innerCp = codegenProperty;
- while (innerCp != null) {
- if (innerCp.complexType != null) {
- imports.add(innerCp.complexType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ imports.add(codegenProperty.baseType);
+ CodegenProperty innerCp = codegenProperty;
+ while (innerCp != null) {
+ if (innerCp.complexType != null) {
+ imports.add(innerCp.complexType);
+ }
+ innerCp = innerCp.items;
}
- innerCp = innerCp.items;
}
if (StringUtils.isEmpty(bodyParameterName)) {
@@ -6782,10 +6968,11 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.pattern = codegenProperty.pattern;
codegenParameter.isNullable = codegenProperty.isNullable;
- if (codegenProperty.complexType != null) {
- imports.add(codegenProperty.complexType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ if (codegenProperty.complexType != null) {
+ imports.add(codegenProperty.complexType);
+ }
}
-
}
// set nullable
setParameterNullable(codegenParameter, codegenProperty);
@@ -6831,19 +7018,31 @@ public class DefaultCodegen implements CodegenConfig {
final ArraySchema arraySchema = (ArraySchema) schema;
Schema inner = getSchemaItems(arraySchema);
CodegenProperty codegenProperty = fromProperty("property", arraySchema, false);
- imports.add(codegenProperty.baseType);
+ if (codegenProperty == null) {
+ throw new RuntimeException("CodegenProperty cannot be null. arraySchema for debugging: " + arraySchema);
+ }
+
+ if (!addSchemaImportsFromV3SpecLocations) {
+ imports.add(codegenProperty.baseType);
+ }
CodegenProperty innerCp = codegenProperty;
CodegenProperty mostInnerItem = innerCp;
// loop through multidimensional array to add proper import
// also find the most inner item
while (innerCp != null) {
- if (innerCp.complexType != null) {
- imports.add(innerCp.complexType);
+ if (!addSchemaImportsFromV3SpecLocations) {
+ if (innerCp.complexType != null) {
+ imports.add(innerCp.complexType);
+ }
}
mostInnerItem = innerCp;
innerCp = innerCp.items;
}
+ if (mostInnerItem == null) {
+ throw new RuntimeException("mostInnerItem (codegen property of array item) cannot be null. " + arraySchema);
+ }
+
if (StringUtils.isEmpty(bodyParameterName)) {
if (StringUtils.isEmpty(mostInnerItem.complexType)) {
codegenParameter.baseName = "request_body";
@@ -6864,9 +7063,11 @@ public class DefaultCodegen implements CodegenConfig {
// set nullable
setParameterNullable(codegenParameter, codegenProperty);
- while (codegenProperty != null) {
- imports.add(codegenProperty.baseType);
- codegenProperty = codegenProperty.items;
+ if (!addSchemaImportsFromV3SpecLocations) {
+ while (codegenProperty != null) {
+ imports.add(codegenProperty.baseType);
+ codegenProperty = codegenProperty.items;
+ }
}
}
}
@@ -6966,10 +7167,27 @@ public class DefaultCodegen implements CodegenConfig {
if (mt.getSchema() != null) {
schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema(), false);
}
- CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
+ HashMap schemaTestCases = null;
+ if (mt.getExtensions() != null && mt.getExtensions().containsKey(xSchemaTestExamplesKey)) {
+ Object objNodeWithRef = mt.getExtensions().get(xSchemaTestExamplesKey);
+ if (objNodeWithRef instanceof LinkedHashMap) {
+ LinkedHashMap nodeWithRef = (LinkedHashMap) objNodeWithRef;
+ String refKey = "$ref";
+ String refToTestCases = nodeWithRef.getOrDefault(refKey, null);
+ if (refToTestCases != null) {
+ schemaTestCases = extractSchemaTestCases(refToTestCases);
+ }
+ }
+ }
+
+ CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap, schemaTestCases);
cmtContent.put(contentType, codegenMt);
if (schemaProp != null) {
- addImports(imports, schemaProp.getImports(false));
+ if (addSchemaImportsFromV3SpecLocations) {
+ addImports(imports, schemaProp.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
+ } else {
+ addImports(imports, schemaProp.getImports(false, importBaseType, generatorMetadata.getFeatureSet()));
+ }
}
}
return cmtContent;
@@ -7060,6 +7278,7 @@ public class DefaultCodegen implements CodegenConfig {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
}
+
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
// set the parameter's example value
@@ -7069,11 +7288,70 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter;
}
+ protected void addRequiredVarsMap(Schema schema, IJsonSchemaValidationProperties property) {
+ /*
+ this should be called after vars and additionalProperties are set
+ Features added by storing codegenProperty values:
+ - complexType stores reference to additionalProperties definition
+ - baseName stores original name (can be invalid in a programming language)
+ - nameInSnakeCase can store valid name for a programming language
+ */
+ Map properties = schema.getProperties();
+ Map requiredVarsMap = new HashMap<>();
+ List requiredPropertyNames = schema.getRequired();
+ if (requiredPropertyNames == null) {
+ return;
+ }
+ for (String requiredPropertyName: requiredPropertyNames) {
+ // required property is defined in properties, value is that CodegenProperty
+ String usedRequiredPropertyName = handleSpecialCharacters(requiredPropertyName);
+ if (properties != null && properties.containsKey(requiredPropertyName)) {
+ // get cp from property
+ boolean found = false;
+ for (CodegenProperty cp: property.getVars()) {
+ if (cp.baseName.equals(requiredPropertyName)) {
+ found = true;
+ requiredVarsMap.put(requiredPropertyName, cp);
+ break;
+ }
+ }
+ if (found == false) {
+ throw new RuntimeException("Property " + requiredPropertyName + " is missing from getVars");
+ }
+ } else if (schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) {
+ // TODO add processing for requiredPropertyName
+ // required property is not defined in properties, and additionalProperties is false, value is null
+ requiredVarsMap.put(usedRequiredPropertyName, null);
+ } else {
+ // required property is not defined in properties, and additionalProperties is true or unset value is CodegenProperty made from empty schema
+ // required property is not defined in properties, and additionalProperties is schema, value is CodegenProperty made from schema
+ if (supportsAdditionalPropertiesWithComposedSchema && !disallowAdditionalPropertiesIfNotPresent) {
+ CodegenProperty cp;
+ if (schema.getAdditionalProperties() == null) {
+ // additionalProperties is null
+ cp = fromProperty(usedRequiredPropertyName, new Schema(), true, true);
+ } else if (schema.getAdditionalProperties() instanceof Boolean && Boolean.TRUE.equals(schema.getAdditionalProperties())) {
+ // additionalProperties is True
+ cp = fromProperty(requiredPropertyName, new Schema(), true, true);
+ } else {
+ // additionalProperties is schema
+ cp = fromProperty(requiredPropertyName, (Schema) schema.getAdditionalProperties(), true, true);
+ }
+ requiredVarsMap.put(usedRequiredPropertyName, cp);
+ }
+ }
+ }
+ if (!requiredVarsMap.isEmpty()) {
+ property.setRequiredVarsMap(requiredVarsMap);
+ }
+ }
+
protected void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property) {
setAddProps(schema, property);
Set mandatory = schema.getRequired() == null ? Collections.emptySet()
: new TreeSet<>(schema.getRequired());
addVars(property, property.getVars(), schema.getProperties(), mandatory);
+ addRequiredVarsMap(schema, property);
}
private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) {
@@ -7580,16 +7858,16 @@ public class DefaultCodegen implements CodegenConfig {
Schema notSchema = schema.getNot();
CodegenProperty notProperty = null;
if (notSchema != null) {
- notProperty = fromProperty("NotSchema", notSchema, false);
+ notProperty = fromProperty("not_schema", notSchema, false);
}
List allOf = new ArrayList<>();
List oneOf = new ArrayList<>();
List anyOf = new ArrayList<>();
if (schema instanceof ComposedSchema) {
ComposedSchema cs = (ComposedSchema) schema;
- allOf = getComposedProperties(cs.getAllOf(), "allOf");
- oneOf = getComposedProperties(cs.getOneOf(), "oneOf");
- anyOf = getComposedProperties(cs.getAnyOf(), "anyOf");
+ allOf = getComposedProperties(cs.getAllOf(), "all_of");
+ oneOf = getComposedProperties(cs.getOneOf(), "one_of");
+ anyOf = getComposedProperties(cs.getAnyOf(), "any_of");
}
return new CodegenComposedSchemas(
allOf,
@@ -7635,4 +7913,41 @@ public class DefaultCodegen implements CodegenConfig {
@Override
public boolean getUseInlineModelResolver() { return true; }
+
+ /*
+ A function to convert yaml or json ingested strings like property names
+ And convert special characters like newline, tab, carriage return
+ Into strings that can be rendered in the language that the generator will output to
+ */
+ protected String handleSpecialCharacters(String name) { return name; }
+
+ /**
+ * Used to ensure that null or Schema is returned given an input Boolean/Schema/null
+ * This will be used in openapi 3.1.0 spec processing to ensure that Booleans become Schemas
+ * Because our generators only understand Schemas
+ * Note: use getIsBooleanSchemaTrue or getIsBooleanSchemaFalse on the IJsonSchemaValidationProperties
+ * if you need to be able to detect if the original schema's value was true or false
+ *
+ * @param schema the input Boolean or Schema data to convert to a Schema
+ * @return Schema the input data converted to a Schema if possible
+ */
+ protected Schema getSchemaFromBooleanOrSchema(Object schema) {
+ if (schema instanceof Boolean) {
+ if (Boolean.TRUE.equals(schema)) {
+ return trueSchema;
+ } else if (Boolean.FALSE.equals(schema)) {
+ return falseSchema;
+ }
+ // null case
+ return null;
+ } else if (schema instanceof Schema) {
+ if (schema == null) {
+ return null;
+ }
+ return (Schema) schema;
+ } else if (schema == null) {
+ return null;
+ }
+ throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema");
+ }
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
index 151e13596a3..2da1e53f84e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
@@ -40,8 +40,8 @@ import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.api.TemplatingEngineAdapter;
import org.openapitools.codegen.api.TemplateFileType;
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
+import org.openapitools.codegen.languages.PythonPriorClientCodegen;
import org.openapitools.codegen.languages.PythonClientCodegen;
-import org.openapitools.codegen.languages.PythonExperimentalClientCodegen;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.model.ApiInfoMap;
@@ -254,6 +254,15 @@ public class DefaultGenerator implements Generator {
}
config.processOpts();
+
+ // resolve inline models
+ if (config.getUseInlineModelResolver()) {
+ InlineModelResolver inlineModelResolver = new InlineModelResolver();
+ inlineModelResolver.setInlineSchemaNameMapping(config.inlineSchemaNameMapping());
+ inlineModelResolver.setInlineSchemaNameDefaults(config.inlineSchemaNameDefault());
+ inlineModelResolver.flatten(openAPI);
+ }
+
config.preprocessOpenAPI(openAPI);
// set OpenAPI to make these available to all methods
@@ -532,7 +541,7 @@ public class DefaultGenerator implements Generator {
ModelMap modelTemplate = modelList.get(0);
if (modelTemplate != null && modelTemplate.getModel() != null) {
CodegenModel m = modelTemplate.getModel();
- if (m.isAlias && !((config instanceof PythonClientCodegen) || (config instanceof PythonExperimentalClientCodegen))) {
+ if (m.isAlias && !((config instanceof PythonPriorClientCodegen) || (config instanceof PythonClientCodegen))) {
// alias to number, string, enum, etc, which should not be generated as model
// for PythonClientCodegen, all aliases are generated as models
continue; // Don't create user-defined classes for aliases
@@ -889,14 +898,6 @@ public class DefaultGenerator implements Generator {
}
}
- // resolve inline models
- if (config.getUseInlineModelResolver()) {
- InlineModelResolver inlineModelResolver = new InlineModelResolver();
- inlineModelResolver.setInlineSchemaNameMapping(config.inlineSchemaNameMapping());
- inlineModelResolver.setInlineSchemaNameDefaults(config.inlineSchemaNameDefault());
- inlineModelResolver.flatten(openAPI);
- }
-
configureGeneratorProperties();
configureOpenAPIInfo();
@@ -1199,16 +1200,18 @@ public class DefaultGenerator implements Generator {
objs.setClassname(config.toApiName(tag));
objs.setPathPrefix(config.toApiVarName(tag));
- // check for operationId uniqueness
- Set opIds = new HashSet<>();
- int counter = 0;
- for (CodegenOperation op : ops) {
- String opId = op.nickname;
- if (opIds.contains(opId)) {
- counter++;
- op.nickname += "_" + counter;
+ // check for nickname uniqueness
+ if (config.getAddSuffixToDuplicateOperationNicknames()) {
+ Set opIds = new HashSet<>();
+ int counter = 0;
+ for (CodegenOperation op : ops) {
+ String opId = op.nickname;
+ if (opIds.contains(opId)) {
+ counter++;
+ op.nickname += "_" + counter;
+ }
+ opIds.add(opId);
}
- opIds.add(opId);
}
objs.setOperation(ops);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
index c3cf15fc36f..d5e8f7faa1f 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
@@ -1,15 +1,28 @@
package org.openapitools.codegen;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
import io.swagger.v3.oas.models.media.Schema;
+import org.openapitools.codegen.meta.FeatureSet;
+import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.utils.ModelUtils;
public interface IJsonSchemaValidationProperties {
+ CodegenProperty getContains();
+
+ void setContains(CodegenProperty contains);
+
+ LinkedHashMap> getDependentRequired();
+
+ void setDependentRequired(LinkedHashMap> dependentRequired);
+
String getPattern();
void setPattern(String pattern);
@@ -46,10 +59,18 @@ public interface IJsonSchemaValidationProperties {
void setMaxItems(Integer maxItems);
+ // TODO update this value to Boolean in 7.0.0
boolean getUniqueItems();
+ // TODO update this value to Boolean in 7.0.0
void setUniqueItems(boolean uniqueItems);
+ // TODO remove in 7.0.0
+ Boolean getUniqueItemsBoolean();
+
+ // TODO remove in 7.0.0
+ void setUniqueItemsBoolean(Boolean uniqueItems);
+
Integer getMinProperties();
void setMinProperties(Integer minProperties);
@@ -115,6 +136,17 @@ public interface IJsonSchemaValidationProperties {
void setRequiredVars(List requiredVars);
+ Map getRequiredVarsMap();
+
+ // goes from required propertyName to its CodegenProperty
+ // Use Cases:
+ // 1. required property is defined in properties, value is that CodegenProperty
+ // 2. required property is not defined in properties, and additionalProperties is true or unset value is CodegenProperty made from empty schema
+ // 3. required property is not defined in properties, and additionalProperties is schema, value is CodegenProperty made from schema
+ // 4. required property is not defined in properties, and additionalProperties is false, value is null
+ void setRequiredVarsMap(Map requiredVarsMap);
+
+
boolean getIsNull();
void setIsNull(boolean isNull);
@@ -153,6 +185,10 @@ public interface IJsonSchemaValidationProperties {
void setIsAnyType(boolean isAnyType);
+ String getRef();
+
+ void setRef(String ref);
+
CodegenComposedSchemas getComposedSchemas();
void setComposedSchemas(CodegenComposedSchemas composedSchemas);
@@ -161,6 +197,24 @@ public interface IJsonSchemaValidationProperties {
void setHasMultipleTypes(boolean hasMultipleTypes);
+ // for when the schema is just the boolean true in a spec
+ boolean getIsBooleanSchemaTrue();
+
+ void setIsBooleanSchemaTrue(boolean isBooleanSchemaTrue);
+
+ // for when the schema is just the boolean false in a spec
+ boolean getIsBooleanSchemaFalse();
+
+ void setIsBooleanSchemaFalse(boolean isBooleanSchemaFalse);
+
+ boolean getSchemaIsFromAdditionalProperties();
+
+ void setSchemaIsFromAdditionalProperties(boolean schemaIsFromAdditionalProperties);
+
+ void setFormat(String format);
+
+ String getFormat();
+
/**
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
* for now this only supports types without format information
@@ -245,32 +299,79 @@ public interface IJsonSchemaValidationProperties {
/**
* Recursively collect all necessary imports to include so that the type may be resolved.
*
- * @param includeContainerTypes whether or not to include the container types in the returned imports.
+ * @param importContainerType whether or not to include the container types in the returned imports.
+ * @param importBaseType whether or not to include the base types in the returned imports.
+ * @param featureSet the generator feature set, used to determine if composed schemas should be added
* @return all of the imports
*/
- default Set getImports(boolean includeContainerTypes) {
+ default Set getImports(boolean importContainerType, boolean importBaseType, FeatureSet featureSet) {
Set imports = new HashSet<>();
if (this.getComposedSchemas() != null) {
- CodegenComposedSchemas composed = (CodegenComposedSchemas) this.getComposedSchemas();
- List allOfs = composed.getAllOf() == null ? Collections.emptyList() : composed.getAllOf();
- List oneOfs = composed.getOneOf() == null ? Collections.emptyList() : composed.getOneOf();
- Stream innerTypes = Stream.concat(allOfs.stream(), oneOfs.stream());
- innerTypes.flatMap(cp -> cp.getImports(includeContainerTypes).stream()).forEach(s -> imports.add(s));
- } else if (includeContainerTypes || !(this.getIsArray() || this.getIsMap())) {
- // this is our base case, add imports for referenced schemas
- // this can't be broken out as a separate if block because Typescript only generates union types as A | B
- // and would need to handle this differently
- imports.add(this.getComplexType());
- imports.add(this.getBaseType());
+ CodegenComposedSchemas composed = this.getComposedSchemas();
+ List allOfs = Collections.emptyList();
+ List oneOfs = Collections.emptyList();
+ List anyOfs = Collections.emptyList();
+ List nots = Collections.emptyList();
+ if (composed.getAllOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.allOf)) {
+ allOfs = composed.getAllOf();
+ }
+ if (composed.getOneOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.oneOf)) {
+ oneOfs = composed.getOneOf();
+ }
+ if (composed.getAnyOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.anyOf)) {
+ anyOfs = composed.getAnyOf();
+ }
+ if (composed.getNot() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.not)) {
+ nots = Arrays.asList(composed.getNot());
+ }
+ Stream innerTypes = Stream.of(
+ allOfs.stream(), anyOfs.stream(), oneOfs.stream(), nots.stream())
+ .flatMap(i -> i);
+ innerTypes.flatMap(cp -> cp.getImports(importContainerType, importBaseType, featureSet).stream()).forEach(s -> imports.add(s));
}
- if (this.getItems() !=null && this.getIsArray()) {
- imports.addAll(this.getItems().getImports(includeContainerTypes));
+ // items can exist for AnyType and type array
+ if (this.getItems() != null && this.getIsArray()) {
+ imports.addAll(this.getItems().getImports(importContainerType, importBaseType, featureSet));
}
+ // additionalProperties can exist for AnyType and type object
if (this.getAdditionalProperties() != null) {
- imports.addAll(this.getAdditionalProperties().getImports(includeContainerTypes));
+ imports.addAll(this.getAdditionalProperties().getImports(importContainerType, importBaseType, featureSet));
}
+ // vars can exist for AnyType and type object
if (this.getVars() != null && !this.getVars().isEmpty()) {
- this.getVars().stream().flatMap(v -> v.getImports(includeContainerTypes).stream()).forEach(s -> imports.add(s));
+ this.getVars().stream().flatMap(v -> v.getImports(importContainerType, importBaseType, featureSet).stream()).forEach(s -> imports.add(s));
+ }
+ if (this.getIsArray() || this.getIsMap()) {
+ if (importContainerType) {
+ /*
+ use-case for this complexType block:
+ DefaultCodegenTest.objectQueryParamIdentifyAsObject
+ DefaultCodegenTest.mapParamImportInnerObject
+ */
+ String complexType = this.getComplexType();
+ if (complexType != null) {
+ imports.add(complexType);
+ }
+ /*
+ use-case:
+ Adding List/Map etc, Java uses this
+ */
+ String baseType = this.getBaseType();
+ if (importBaseType && baseType != null) {
+ imports.add(baseType);
+ }
+ }
+ } else {
+ // referenced or inline schemas
+ String complexType = this.getComplexType();
+ if (complexType != null) {
+ imports.add(complexType);
+ }
+ String baseType = this.getBaseType();
+ if (importBaseType && baseType != null) {
+ imports.add(baseType);
+ }
+ return imports;
}
return imports;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java
index b839960d28c..ef684023d35 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java
@@ -167,7 +167,7 @@ public class InlineModelResolver {
* Return true if a model should be generated e.g. object with properties,
* enum, oneOf, allOf, anyOf, etc.
*
- * @param schema target schema
+ * @param schema target schema
* @param visitedSchemas Visited schemas
*/
private boolean isModelNeeded(Schema schema, Set visitedSchemas) {
@@ -189,6 +189,17 @@ public class InlineModelResolver {
if (schema instanceof ComposedSchema) {
// allOf, anyOf, oneOf
ComposedSchema m = (ComposedSchema) schema;
+
+ if (m.getAllOf() != null && m.getAllOf().size() == 1 && m.getReadOnly() != null && m.getReadOnly()) {
+ // Check if this composed schema only contains an allOf and a readOnly.
+ ComposedSchema c = new ComposedSchema();
+ c.setAllOf(m.getAllOf());
+ c.setReadOnly(true);
+ if (m.equals(c)) {
+ return isModelNeeded(m.getAllOf().get(0), visitedSchemas);
+ }
+ }
+
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
// check to ensure at least of the allOf item is model
for (Schema inner : m.getAllOf()) {
@@ -429,6 +440,10 @@ public class InlineModelResolver {
if (requestBody.get$ref() != null) {
String ref = ModelUtils.getSimpleRef(requestBody.get$ref());
requestBody = openAPI.getComponents().getRequestBodies().get(ref);
+
+ if (requestBody == null) {
+ return;
+ }
}
flattenContent(requestBody.getContent(),
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
index 960a6ae7f33..4281abea4fe 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
@@ -118,7 +118,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
);
mapTypes = new HashSet<>(
- Arrays.asList("IDictionary")
+ Arrays.asList("IDictionary", "Dictionary")
);
// NOTE: C# uses camel cased reserved words, while models are title cased. We don't want lowercase comparisons.
@@ -292,7 +292,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// {{sourceFolder}}
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
-
+
// TODO: Move to its own option when a parameter for 'testFolder' is added.
setTestFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
} else {
@@ -428,6 +428,17 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
+ if (property.isInnerEnum && property.items != null) {
+ // format maps of inner enums to include the classname eg: Dictionary
+ property.datatypeWithEnum = property.datatypeWithEnum.replace(property.items.datatypeWithEnum, model.classname + "." + property.items.datatypeWithEnum);
+ property.dataType = property.datatypeWithEnum;
+ }
+ if (property.isMap || property.isContainer) {
+ // maps of enums will be marked both isMap and isEnum, correct that now
+ property.isEnum = false;
+ property.isInnerEnum = false;
+ property.isString = false;
+ }
}
@Override
@@ -459,9 +470,59 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
postProcessEnumRefs(processed);
updateValueTypeProperty(processed);
updateNullableTypeProperty(processed);
+
+ for (Map.Entry entry : objs.entrySet()) {
+ CodegenModel model = ModelUtils.getModelByName(entry.getKey(), objs);
+
+ // https://github.com/OpenAPITools/openapi-generator/issues/12324
+ // TODO: why do these collections contain different instances?
+ // fixing allVars should suffice instead of patching every collection
+ for (CodegenProperty property : model.allVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.vars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.readWriteVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.optionalVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.parentVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.requiredVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.readOnlyVars){
+ patchProperty(model, property);
+ }
+ for (CodegenProperty property : model.nonNullableVars){
+ patchProperty(model, property);
+ }
+ }
return processed;
}
+ private void patchProperty(CodegenModel model, CodegenProperty property){
+ /**
+ * Hotfix for this issue
+ * https://github.com/OpenAPITools/openapi-generator/issues/12155
+ */
+ if (property.dataType.equals("List") && property.getComposedSchemas() != null && property.getComposedSchemas().getAllOf() != null){
+ List composedSchemas = property.getComposedSchemas().getAllOf();
+ if (composedSchemas.size() == 0) {
+ return;
+ }
+ CodegenProperty composedProperty = composedSchemas.stream().findFirst().get();
+ property.dataType = composedProperty.dataType;
+ property.datatypeWithEnum = composedProperty.datatypeWithEnum;
+ property.isMap = composedProperty.isMap;
+ property.isContainer = composedProperty.isContainer;
+ }
+ }
+
@Override
protected List