Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !13256

[python-experimental] creates + uses MetaOapg cls to store non-properties schema keywords

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/spacether/python_exp_creates_meta into master 2 years ago
  • Overview 1
  • Commits 16
  • Pipelines 0
  • Changes 123

Created by: spacether

[python-experimental] creates + uses MetaOapg cls to store non properties schema keywords I will use the MetaOapg class to store additional keyword info from v3.1.0 schemas

Adds get/setUniqueItemsBoolean to the IJsonSchemaValidationProperties interface This is needed so code can determine if uniqueItems is true/false/unset

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Compare
  • master (base)

and
  • latest version
    48aa9f0d
    16 commits, 2 years ago

123 files
+ 2820
- 2536

    Preferences

    File browser
    Compare changes
modules/openap‎i-generator/src‎
ma‎in‎
java/org/opena‎pitools/codegen‎
ut‎ils‎
ModelUt‎ils.java‎ +1 -0
CodegenM‎odel.java‎ +15 -1
CodegenPar‎ameter.java‎ +15 -1
CodegenPro‎perty.java‎ +14 -1
CodegenRes‎ponse.java‎ +15 -1
DefaultCo‎degen.java‎ +1 -1
IJsonSchemaValidat‎ionProperties.java‎ +8 -0
resources/pyth‎on-experimental‎
model_t‎emplates‎
composed_sche‎mas.handlebars‎ +8 -29
schema_composed_or‎_anytype.handlebars‎ +9 -5
schema_dict‎.handlebars‎ +5 -2
schema_list‎.handlebars‎ +7 -4
schema_simpl‎e.handlebars‎ +4 -3
validations‎.handlebars‎ +13 -13
schemas.h‎andlebars‎ +88 -64
test/java/org/opena‎pitools/codegen/java‎
JavaModel‎Test.java‎ +1 -1
sam‎ples‎
openapi‎3/client‎
3_0_3_unit_test‎/…/unit_test_api‎
mo‎del‎
additionalproperties_should‎_not_look_in_applicators.py‎ +37 -35
allo‎f.py‎ +64 -62
allof_combined_wi‎th_anyof_oneof.py‎ +110 -99
allof_simp‎le_types.py‎ +60 -52
allof_with_b‎ase_schema.py‎ +64 -62
allof_with_one_‎empty_schema.py‎ +18 -16
allof_with_the_fir‎st_empty_schema.py‎ +20 -18
allof_with_the_la‎st_empty_schema.py‎ +20 -18
allof_with_two_‎empty_schemas.py‎ +20 -18
anyo‎f.py‎ +40 -35
anyof_compl‎ex_types.py‎ +64 -62
anyof_with_b‎ase_schema.py‎ +60 -52
anyof_with_one_‎empty_schema.py‎ +20 -18
by_i‎nt.py‎ +4 -1
by_num‎ber.py‎ +4 -1
by_small_‎number.py‎ +4 -1
forbidden_‎property.py‎ +3 -16
invalid_instance_should_not_raise‎_error_when_float_division_inf.py‎ +4 -2
invalid_string_va‎lue_for_default.py‎ +4 -2
maximum_va‎lidation.py‎ +4 -1
maximum_validation_wi‎th_unsigned_integer.py‎ +4 -1
maxitems_va‎lidation.py‎ +4 -1
maxlength_v‎alidation.py‎ +4 -1
maxproperties0_means_‎the_object_is_empty.py‎ +4 -1
maxproperties‎_validation.py‎ +4 -1
minimum_va‎lidation.py‎ +4 -1
minimum_validation_w‎ith_signed_integer.py‎ +4 -1
minitems_va‎lidation.py‎ +4 -1
minlength_v‎alidation.py‎ +4 -1
minproperties‎_validation.py‎ +4 -1
model_‎not.py‎ +3 -16
nested_allof_to_check_‎validation_semantics.py‎ +40 -36
nested_anyof_to_check_‎validation_semantics.py‎ +40 -36
nested_oneof_to_check_‎validation_semantics.py‎ +40 -36
not_more_comp‎lex_schema.py‎ +23 -36
oneo‎f.py‎ +40 -35
oneof_compl‎ex_types.py‎ +64 -62
oneof_with_b‎ase_schema.py‎ +60 -52
oneof_with_em‎pty_schema.py‎ +20 -18
oneof_with_‎required.py‎ +60 -58
pattern_is_no‎t_anchored.py‎ +6 -3
pattern_va‎lidation.py‎ +6 -3
ref_in_‎allof.py‎ +17 -15
ref_in_‎anyof.py‎ +17 -15
ref_in‎_not.py‎ +7 -15
ref_in_‎oneof.py‎ +17 -15
the_default_keyword_does_not_do_any‎thing_if_the_property_is_missing.py‎ +4 -2
uniqueitems_fal‎se_validation.py‎ +4 -0
uniqueitems_‎validation.py‎ +4 -1
pa‎ths‎
request_body_post_not_more_‎complex_schema_request_body‎
pos‎t.py‎ +23 -36
request_body_post‎_not_request_body‎
pos‎t.py‎ +3 -16
request_body_post_re‎f_in_not_request_body‎
pos‎t.py‎ +7 -15
response_body_post_not_more_complex_s‎chema_response_body_for_content_types‎
pos‎t.py‎ +23 -36
response_body_post_not_resp‎onse_body_for_content_types‎
pos‎t.py‎ +3 -16
response_body_post_ref_in_not_‎response_body_for_content_types‎
pos‎t.py‎ +7 -15
schem‎as.py‎ +88 -64
petstore/pytho‎n-experimental‎
petsto‎re_api‎
mo‎del‎
any_type_no‎t_string.py‎ +3 -16
appl‎e.py‎ +15 -11
array_with_valida‎tions_in_items.py‎ +8 -3
cat‎.py‎ +39 -37
child_‎cat.py‎ +39 -37
complex_quad‎rilateral.py‎ +49 -47
composed_any_of_differen‎t_types_no_validations.py‎ +53 -51
composed‎_bool.py‎ +18 -16
composed‎_none.py‎ +18 -16
composed_‎number.py‎ +18 -16
composed_‎object.py‎ +18 -16
composed_one_of_d‎ifferent_types.py‎ +70 -60
composed_‎string.py‎ +18 -16
date_time_with‎_validations.py‎ +6 -4
date_with_va‎lidations.py‎ +6 -4
dog‎.py‎ +39 -37
equilateral‎_triangle.py‎ +49 -47
format_‎test.py‎ +60 -39
frui‎t.py‎ +18 -16
fruit_‎req.py‎ +20 -18
gm_fr‎uit.py‎ +18 -16
integer_‎max10.py‎ +4 -2
integer_‎min15.py‎ +4 -2
isosceles_‎triangle.py‎ +49 -47
mamm‎al.py‎ +19 -17
nullable‎_shape.py‎ +20 -18
number_with_v‎alidations.py‎ +5 -3
object_with_inline_co‎mposition_property.py‎ +26 -22
object_with_v‎alidations.py‎ +4 -1
parent‎_pet.py‎ +17 -15
pig‎.py‎ +18 -16
quadrila‎teral.py‎ +18 -16
scalene_t‎riangle.py‎ +49 -47
shap‎e.py‎ +18 -16
shape_or‎_null.py‎ +20 -18
simple_quad‎rilateral.py‎ +49 -47
some_ob‎ject.py‎ +17 -15
string_with_‎validation.py‎ +4 -2
trian‎gle.py‎ +19 -17
use‎r.py‎ +3 -16
uuid_st‎ring.py‎ +4 -2
pa‎ths‎
fak‎e_1‎
pos‎t.py‎ +44 -28
fake_inline_‎composition_‎
pos‎t.py‎ +156 -132
store_order‎_order_id_1‎
get‎.py‎ +5 -3
schem‎as.py‎ +88 -64
tests_‎manual‎
test_an‎imal.py‎ +4 -4
test_any_ty‎pe_schema.py‎ +50 -50
test_f‎ruit.py‎ +1 -2
test_fru‎it_req.py‎ +5 -5
test_gm_‎fruit.py‎ +2 -2
test_val‎idate.py‎ +20 -23
server/petstore/…‎/…/…/…/…/…/handler‎
PathHandlerI‎nterface.java‎ +2 -2
modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
+ 1
- 0
  • View file @ 48aa9f0d

  • Edit in single-file editor

  • Open in Web IDE


@@ -1677,6 +1677,7 @@ public class ModelUtils {
if (minItems != null) target.setMinItems(minItems);
if (maxItems != null) target.setMaxItems(maxItems);
if (uniqueItems != null) target.setUniqueItems(uniqueItems);
if (uniqueItems != null) target.setUniqueItemsBoolean(uniqueItems);
}
private static void setObjectValidations(Integer minProperties, Integer maxProperties, IJsonSchemaValidationProperties target) {
modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+ 15
- 1
  • View file @ 48aa9f0d

  • Edit in single-file editor

  • Open in Web IDE


@@ -147,6 +147,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;
@@ -558,6 +559,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;
@@ -940,6 +951,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getUniqueItems() == that.getUniqueItems() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(composedSchemas, that.composedSchemas) &&
@@ -1014,7 +1026,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref);
isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref,
uniqueItemsBoolean);
}
@Override
@@ -1089,6 +1102,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);
modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+ 15
- 1
  • View file @ 48aa9f0d

  • Edit in single-file editor

  • Open in Web IDE


@@ -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
*/
@@ -148,6 +149,7 @@ 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;
@@ -238,7 +240,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, requiredVarsMap, ref);
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, requiredVarsMap, ref, uniqueItemsBoolean);
}
@Override
@@ -294,6 +296,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
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()) &&
@@ -414,6 +417,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);
@@ -531,6 +535,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;
modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+ 14
- 1
  • View file @ 48aa9f0d

  • Edit in single-file editor

  • Open in Web IDE


@@ -181,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;
@@ -725,6 +726,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;
@@ -977,6 +988,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('\'');
@@ -1050,6 +1062,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
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(composedSchemas, that.composedSchemas) &&
@@ -1116,6 +1129,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
ref);
ref, uniqueItemsBoolean);
}
}
modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
+ 15
- 1
  • View file @ 48aa9f0d

  • Edit in single-file editor

  • Open in Web IDE


@@ -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;
@@ -103,7 +104,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content,
requiredVarsMap, ref);
requiredVarsMap, ref,uniqueItemsBoolean);
}
@Override
@@ -152,6 +153,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
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()) &&
@@ -301,6 +303,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;
@@ -519,6 +532,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);
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
Client: Python
1
Client: Python
    Assign labels
  • Manage project labels

Milestone
6.1.0
6.1.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: OpenAPITools/openapi-generator!13256
Source branch: github/fork/spacether/python_exp_creates_meta

Menu

Explore Projects Groups Snippets