diff --git a/flex/openapi/openapi_interactive.yaml b/flex/openapi/openapi_interactive.yaml index a2b2f6e51c5a..126701fdf3fc 100644 --- a/flex/openapi/openapi_interactive.yaml +++ b/flex/openapi/openapi_interactive.yaml @@ -1538,135 +1538,143 @@ components: $ref: '#/components/schemas/AnyValue' PrimitiveType: x-body-name: primitive_type + allOf: + - $ref: '#/components/schemas/BaseGSDataType' + - type: object + required: + - primitive_type + properties: + primitive_type: + type: string + enum: [DT_SIGNED_INT32, DT_UNSIGNED_INT32, DT_SIGNED_INT64, DT_UNSIGNED_INT64, + DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_STRING] + # The DT_STRING is added for backward compatibility, it should be replaced by StringType + example: DT_SIGNED_INT32 + BaseStringType: + x-body-name: base_string_type type: object - required: - - primitive_type - - ref_type + required: + - string_type properties: - primitive_type: + string_type: type: string - enum: [DT_SIGNED_INT32, DT_UNSIGNED_INT32, DT_SIGNED_INT64, DT_UNSIGNED_INT64, - DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_STRING] - # The DT_STRING is added for backward compatibility, it should be replaced by StringType - example: DT_SIGNED_INT32 - ref_type: - type: string - example: "PrimitiveType" + discriminator: + propertyName: string_type LongText: x-body-name: long_text - type: object - additionalProperties: false - required: - - long_text - - string_ref_type - properties: - long_text: - type: string - nullable: true - string_ref_type: - type: string - example: "LongText" + allOf: + - $ref: '#/components/schemas/BaseStringType' + - type: object + additionalProperties: false + required: + - long_text + properties: + long_text: + type: string + nullable: true FixedChar: x-body-name: fixed_char - type: object - additionalProperties: false - required: - - char - - string_ref_type - properties: - char: - type: object + allOf: + - $ref: '#/components/schemas/BaseStringType' + - type: object + additionalProperties: false required: - - fixed_length + - char properties: - fixed_length: - type: integer - string_ref_type: - type: string - example: "FixedChar" + char: + type: object + required: + - fixed_length + properties: + fixed_length: + type: integer VarChar: x-body-name: var_char - type: object - additionalProperties: false - required: - - var_char - - string_ref_type - properties: - var_char: - type: object + allOf: + - $ref: '#/components/schemas/BaseStringType' + - type: object + additionalProperties: false required: - - max_length + - var_char properties: - max_length: - type: integer - string_ref_type: - type: string - example: "VarChar" + var_char: + type: object + required: + - max_length + properties: + max_length: + type: integer StringType: x-body-name: string_type + allOf: + - $ref: '#/components/schemas/BaseGSDataType' + - type: object + required: + - string + properties: + string: + oneOf: + - $ref: '#/components/schemas/LongText' + - $ref: '#/components/schemas/FixedChar' + - $ref: '#/components/schemas/VarChar' + BaseTemporalType: + x-body-name: base_temporal_type type: object - required: - - string - - ref_type + required: + - temporal_type properties: - string: - oneOf: - - $ref: '#/components/schemas/LongText' - - $ref: '#/components/schemas/FixedChar' - - $ref: '#/components/schemas/VarChar' - discriminator: - propertyName: string_ref_type - ref_type: + temporal_type: type: string - example: "StringType" + discriminator: + propertyName: temporal_type TimeStampType: x-body-name: time_stamp_type - type: object - required: - - timestamp - - temporal_ref_type - properties: - timestamp: - type: string - temporal_ref_type: - type: string - example: "TimeStampType" + allOf: + - $ref: '#/components/schemas/BaseTemporalType' + - type: object + required: + - timestamp + properties: + timestamp: + type: string DateType: x-body-name: date_type - type: object - required: - - date32 - - temporal_ref_type - properties: - date32: - type: string - temporal_ref_type: - type: string - example: "DateType" + allOf: + - $ref: '#/components/schemas/BaseTemporalType' + - type: object + required: + - date32 + properties: + date32: + type: string TemporalType: x-body-name: temporal_type + allOf: + - $ref: '#/components/schemas/BaseGSDataType' + - type: object + required: + - temporal + properties: + temporal: + oneOf: + - $ref: '#/components/schemas/TimeStampType' + - $ref: '#/components/schemas/DateType' + BaseGSDataType: + x-body-name: base_gs_data_type type: object required: - - temporal - - ref_type + - type_name properties: - temporal: - oneOf: - - $ref: '#/components/schemas/TimeStampType' - - $ref: '#/components/schemas/DateType' - discriminator: - propertyName: temporal_ref_type - ref_type: + type_name: type: string - example: "TemporalType" + discriminator: + propertyName: type_name GSDataType: x-body-name: gs_data_type oneOf: - $ref: '#/components/schemas/PrimitiveType' - $ref: '#/components/schemas/StringType' - $ref: '#/components/schemas/TemporalType' - discriminator: - propertyName: ref_type Property: x-body-name: property type: object diff --git a/interactive_engine/groot-http/src/main/java/com/alibaba/graphscope/groot/service/impl/DtoConverter.java b/interactive_engine/groot-http/src/main/java/com/alibaba/graphscope/groot/service/impl/DtoConverter.java index 42f1480ab658..d89091213ae1 100644 --- a/interactive_engine/groot-http/src/main/java/com/alibaba/graphscope/groot/service/impl/DtoConverter.java +++ b/interactive_engine/groot-http/src/main/java/com/alibaba/graphscope/groot/service/impl/DtoConverter.java @@ -18,6 +18,7 @@ import com.alibaba.graphscope.groot.service.models.Property; import com.alibaba.graphscope.groot.service.models.StringType; import com.alibaba.graphscope.groot.service.models.TemporalType; +import com.alibaba.graphscope.groot.service.models.TemporalTypeAllOfTemporal; import com.alibaba.graphscope.groot.service.models.TemporalTypeTemporal; import com.alibaba.graphscope.groot.service.models.TimeStampType; import com.alibaba.graphscope.groot.service.models.VertexRequest; @@ -97,7 +98,7 @@ public static DataTypePb convertToDataTypePb(GSDataType dataType) { return DataTypePb.STRING; } else if (dataType instanceof TemporalType) { TemporalType temporalType = (TemporalType) dataType; - TemporalTypeTemporal temporal = temporalType.getTemporal(); + TemporalTypeAllOfTemporal temporal = temporalType.getTemporal(); if (temporal instanceof DateType) { return DataTypePb.DATE32; } else if (temporal instanceof TimeStampType) { @@ -178,12 +179,12 @@ private static GSDataType convertToDtoDataType(DataTypePb dataType) { case STRING: return new PrimitiveType(PrimitiveType.PrimitiveTypeEnum.STRING, "PrimitiveType"); case DATE32: - TemporalTypeTemporal date = new DateType("YYYY-MM-DD".toString(), "DateType"); + TemporalTypeAllOfTemporal date = new DateType("YYYY-MM-DD".toString(), "DateType"); return new TemporalType(date, "TemporalType"); case TIMESTAMP_MS: // TODO: confirm the format of timestamp? should be int64 milliseconds since // 1970-01-01 00:00:00.000000? - TemporalTypeTemporal timestamp = + TemporalTypeAllOfTemporal timestamp = new TimeStampType("YYYY-MM-DD HH:MM:SS".toString(), "TimeStampType"); return new TemporalType(timestamp, "TemporalType"); default: