Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit a86e382

Browse files
committed
Adds true and false options
1 parent 39a9de8 commit a86e382

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/generators/python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2222
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
2323
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
2424
|library|library template (sub-template) to use: urllib3| |urllib3|
25-
|nonCompliantUseDiscriminatorIfCompositionFails|When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a discriminator is present, then ignore the compostion 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 compotion 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| |false|
25+
|nonCompliantUseDiscriminatorIfCompositionFails|When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a discriminator is present, then ignore the compostion 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|<dl><dt>**true**</dt><dd>If composition fails and a discriminator exists, the composition errors will be ignored and validation will be attempted with the discriminator</dd><dt>**false**</dt><dd>Composition validation must succeed. Discriminator validation must succeed.</dd></dl>|false|
2626
|packageName|python package name (convention: snake_case).| |openapi_client|
2727
|packageUrl|python package URL.| |null|
2828
|packageVersion|python package version.| |1.0.0|

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ public PythonClientCodegen() {
216216
cliOptions.add(CliOption.newBoolean(USE_INLINE_MODEL_RESOLVER, "use the inline model resolver, if true inline complex models will be extracted into components and $refs to them will be used").
217217
defaultValue(Boolean.FALSE.toString()));
218218
CliOption nonCompliantUseDiscrIfCompositionFails = CliOption.newBoolean(CodegenConstants.NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS, CodegenConstants.NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS_DESC);
219+
Map<String, String> nonCompliantUseDiscrIfCompositionFailsOpts = new HashMap<>();
220+
nonCompliantUseDiscrIfCompositionFailsOpts.put("true", "If composition fails and a discriminator exists, the composition errors will be ignored and validation will be attempted with the discriminator");
221+
nonCompliantUseDiscrIfCompositionFailsOpts.put("false", "Composition validation must succeed. Discriminator validation must succeed.");
222+
nonCompliantUseDiscrIfCompositionFails.setEnum(nonCompliantUseDiscrIfCompositionFailsOpts);
223+
219224
cliOptions.add(nonCompliantUseDiscrIfCompositionFails);
220225

221226
supportedLibraries.put("urllib3", "urllib3-based client");

0 commit comments

Comments
 (0)