Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes uuid properties in python-exp, changes maps to object data type…
…, adds uuid data type
  • Loading branch information
spacether committed Apr 16, 2022
commit 0df3bce64a599a9c1ceaae5d11f943ff336f02b7
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ public enum DataTypeFeature {
Array,

/**
* Supports map of data
* An unordered set of properties mapping a string to an instance
*/
@ToolingExtension
Maps,
@OAS2 @OAS3
Object,

/**
* Supports specifying the format of the array if type array is used (one of: csv, ssv, tsv, pipes).
Expand Down Expand Up @@ -236,5 +236,10 @@ public enum DataTypeFeature {
* Supports a map of arrays (enums)
*/
@ToolingExtension
MapOfCollectionOfEnum
MapOfCollectionOfEnum,

/**
* String uuid data
*/
Uuid
}
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,9 @@ public void setHasMultipleTypes(boolean hasMultipleTypes) {
this.hasMultipleTypes = hasMultipleTypes;
}

public boolean getisUuid() { return isUuid; }
public boolean getIsUuid() { return isUuid; }

public void setisUuid(boolean isUuid) { this.isUuid = isUuid; }
public void setIsUuid(boolean isUuid) { this.isUuid = isUuid; }

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class DefaultCodegen implements CodegenConfig {
DataTypeFeature.Int32, DataTypeFeature.Int64, DataTypeFeature.Float, DataTypeFeature.Double,
DataTypeFeature.Decimal, DataTypeFeature.String, DataTypeFeature.Byte, DataTypeFeature.Binary,
DataTypeFeature.Boolean, DataTypeFeature.Date, DataTypeFeature.DateTime, DataTypeFeature.Password,
DataTypeFeature.File, DataTypeFeature.Array, DataTypeFeature.Maps, DataTypeFeature.CollectionFormat,
DataTypeFeature.File, DataTypeFeature.Array, DataTypeFeature.Object, DataTypeFeature.Maps, DataTypeFeature.CollectionFormat,
DataTypeFeature.CollectionFormatMulti, DataTypeFeature.Enum, DataTypeFeature.ArrayOfEnum, DataTypeFeature.ArrayOfModel,
DataTypeFeature.ArrayOfCollectionOfPrimitives, DataTypeFeature.ArrayOfCollectionOfModel, DataTypeFeature.ArrayOfCollectionOfEnum,
DataTypeFeature.MapOfEnum, DataTypeFeature.MapOfModel, DataTypeFeature.MapOfCollectionOfPrimitives,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public PythonExperimentalClientCodegen() {
SecurityFeature.ApiKey,
SecurityFeature.OAuth2_Implicit
))
.includeDataTypeFeatures(
DataTypeFeature.Uuid
)
.includeGlobalFeatures(
GlobalFeature.ParameterizedServer,
GlobalFeature.ParameterStyling
Expand Down Expand Up @@ -2006,7 +2009,7 @@ protected void updatePropertyForString(CodegenProperty property, Schema p) {
property.isFile = true; // file = binary in OAS3
} else if (ModelUtils.isUUIDSchema(p)) {
property.setIsString(false); // so the templates only see isUuid
property.isUuid = true;
property.setIsUuid(true);
} else if (ModelUtils.isURISchema(p)) {
property.isUri = true;
} else if (ModelUtils.isEmailSchema(p)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}{{/if}} = {{#if complexType}}{{complexType}}{{else}}{{#if isNullable}}Nullable{{/if}}{{#if getIsNull}}None{{/if}}{{#if isAnyType}}AnyType{{/if}}{{#if isMap}}Dict{{/if}}{{#if isArray}}List{{/if}}{{#if isString}}Str{{/if}}{{#if isByteArray}}Str{{/if}}{{#if isDate}}Date{{/if}}{{#if isDateTime}}DateTime{{/if}}{{#if isDecimal}}Decimal{{/if}}{{#if isUnboundedInteger}}Int{{/if}}{{#if isShort}}Int32{{/if}}{{#if isLong}}Int64{{/if}}{{#if isFloat}}Float32{{/if}}{{#if isDouble}}Float64{{/if}}{{#if isNumber}}Number{{/if}}{{#if isBoolean}}Bool{{/if}}{{#if isBinary}}Binary{{/if}}Schema{{/if}}
{{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}{{/if}} = {{#if complexType}}{{complexType}}{{else}}{{#if isNullable}}Nullable{{/if}}{{#if getIsNull}}None{{/if}}{{#if isAnyType}}AnyType{{/if}}{{#if isMap}}Dict{{/if}}{{#if isArray}}List{{/if}}{{#if isString}}Str{{/if}}{{#if isByteArray}}Str{{/if}}{{#if getIsUuid}}UUID{{/if}}{{#if isDate}}Date{{/if}}{{#if isDateTime}}DateTime{{/if}}{{#if isDecimal}}Decimal{{/if}}{{#if isUnboundedInteger}}Int{{/if}}{{#if isShort}}Int32{{/if}}{{#if isLong}}Int64{{/if}}{{#if isFloat}}Float32{{/if}}{{#if isDouble}}Float64{{/if}}{{#if isNumber}}Number{{/if}}{{#if isBoolean}}Bool{{/if}}{{#if isBinary}}Binary{{/if}}Schema{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class string(
binary = BinarySchema
date = DateSchema
dateTime = DateTimeSchema
uuid = Schema
uuidNoExample = Schema
uuid = UUIDSchema
uuidNoExample = UUIDSchema


class password(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(

Do not edit the class manually.
"""
uuid = Schema
uuid = UUIDSchema
dateTime = DateTimeSchema


Expand Down