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/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java index 01702710e53..88f80437ff2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java @@ -50,8 +50,8 @@ public class CrystalClientCodegen extends DefaultCodegen { private static final String NUMERIC_ENUM_PREFIX = "N"; protected static int emptyMethodNameCounter = 0; - protected String shardName; - protected String moduleName; + protected String shardName = "openapi_client"; + protected String moduleName = "OpenAPIClient"; protected String shardVersion = "1.0.0"; protected String specFolder = "spec"; protected String srcFolder = "src"; @@ -65,6 +65,7 @@ public class CrystalClientCodegen extends DefaultCodegen { protected String modelDocPath = "docs/"; public static final String SHARD_NAME = "shardName"; + public static final String MODULE_NAME = "moduleName"; public static final String SHARD_VERSION = "shardVersion"; public static final String SHARD_LICENSE = "shardLicense"; public static final String SHARD_HOMEPAGE = "shardHomepage"; @@ -196,6 +197,9 @@ public class CrystalClientCodegen extends DefaultCodegen { cliOptions.add(new CliOption(SHARD_NAME, "shard name (e.g. twitter_client"). defaultValue("openapi_client")); + cliOptions.add(new CliOption(MODULE_NAME, "module name (e.g. TwitterClient"). + defaultValue("OpenAPIClient")); + cliOptions.add(new CliOption(SHARD_VERSION, "shard version.").defaultValue("1.0.0")); cliOptions.add(new CliOption(SHARD_LICENSE, "shard license."). @@ -228,6 +232,11 @@ public class CrystalClientCodegen extends DefaultCodegen { } additionalProperties.put(SHARD_NAME, shardName); + if (additionalProperties.containsKey(MODULE_NAME)) { + setModuleName((String) additionalProperties.get(MODULE_NAME)); + } + additionalProperties.put(MODULE_NAME, moduleName); + if (additionalProperties.containsKey(SHARD_VERSION)) { setShardVersion((String) additionalProperties.get(SHARD_VERSION)); } else {