Skip to content

Commit

Permalink
Address PR commentsAddress PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Mauel Heredia Hidalgo committed May 26, 2023
1 parent 91addff commit 48e4eb6
Show file tree
Hide file tree
Showing 12 changed files with 462 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function generateObject(cadlObject: CadlObject) {
propertyDoc && definitions.push(propertyDoc);
const decorators = generateDecorators(property.decorators);
decorators && definitions.push(decorators);

property.fixMe && property.fixMe.length && definitions.push(property.fixMe.join("\n"));
definitions.push(`"${property.name}"${getOptionalOperator(property)}: ${property.type};`);
}
definitions.push("}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { transformValue } from "../utils/values";

const cadlTypes = new Map<SchemaType, string>([
[SchemaType.Date, "plainDate"],
[SchemaType.DateTime, "offsetDateTime"],
[SchemaType.DateTime, "utcDateTime"],
[SchemaType.UnixTime, "plainTime"],
[SchemaType.String, "string"],
[SchemaType.Time, "plainTime"],
Expand Down Expand Up @@ -131,9 +131,19 @@ export function transformObjectProperty(propertySchema: Property, codeModel: Cod
isOptional: propertySchema.required !== true,
type: getCadlType(propertySchema.schema, codeModel),
decorators: getPropertyDecorators(propertySchema),
fixMe: getFixme(propertySchema, codeModel),
};
}

function getFixme(property: Property, codeModel: CodeModel): string[] {
const cadlType = getCadlType(property.schema, codeModel);
if (cadlType === "utcDateTime") {
return ["// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario."];
}

return [];
}

function getParents(schema: ObjectSchema): string[] {
const immediateParents = schema.parents?.immediate ?? [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,20 @@ model ProjectsMetadata is Azure.Core.Page<ProjectMetadata>;
@resource("authoring/analyze-text/projects")
model ProjectMetadata {
@doc("Represents the project creation datetime.")
createdDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
createdDateTime: utcDateTime;

@doc("Represents the project last modification datetime.")
lastModifiedDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastModifiedDateTime: utcDateTime;

@doc("Represents the project last training datetime.")
lastTrainedDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastTrainedDateTime?: utcDateTime;

@doc("Represents the project last deployment datetime.")
lastDeployedDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastDeployedDateTime?: utcDateTime;

@doc("The project kind.")
projectKind: ProjectKind;
Expand Down Expand Up @@ -305,10 +309,12 @@ model ProjectDeployment {
modelId: string;

@doc("Represents deployment last trained time.")
lastTrainedDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastTrainedDateTime: utcDateTime;

@doc("Represents deployment last deployed time.")
lastDeployedDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastDeployedDateTime: utcDateTime;

@doc("Represents deployment expiration date in the runtime.")
deploymentExpirationDate: plainDate;
Expand Down Expand Up @@ -345,13 +351,16 @@ model JobState {
jobId: string;

@doc("The creation date time of the job.")
createdDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
createdDateTime: utcDateTime;

@doc("The last date time the job was updated.")
lastUpdatedDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastUpdatedDateTime: utcDateTime;

@doc("The expiration date time of the job.")
expirationDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
expirationDateTime?: utcDateTime;

@doc("The job status.")
status: JobStatus;
Expand Down Expand Up @@ -400,7 +409,8 @@ model ProjectTrainedModel {
modelId: string;

@doc("The last trained date time of the model.")
lastTrainedDateTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastTrainedDateTime: utcDateTime;

@doc("The duration of the model's last training request in seconds.")
lastTrainingDurationInSeconds: int32;
Expand Down Expand Up @@ -466,7 +476,8 @@ model TrainingJobResult {
evaluationStatus?: SubTrainingJobState;

@doc("Represents the estimate end date time for training and evaluation.")
estimatedEndDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
estimatedEndDateTime?: utcDateTime;
}

@doc("Represents the detailed state of a training sub-operation.")
Expand All @@ -475,10 +486,12 @@ model SubTrainingJobState {
percentComplete: int32;

@doc("Represents the start date time.")
startDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
startDateTime?: utcDateTime;

@doc("Represents the end date time.")
endDateTime?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
endDateTime?: utcDateTime;

@doc("Represents the status of the sub-operation.")
status: JobStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ and imputeMode is \"fixed\".
@doc("The definition of input timeseries points.")
model TimeSeriesPoint {
@doc("Optional argument, timestamp of a data point (ISO8601 format).")
timestamp?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
timestamp?: utcDateTime;

@doc("The measurement of that point, should be float.")
value: float32;
Expand Down Expand Up @@ -383,10 +384,12 @@ model VariableState {
effectiveCount?: int32;

@doc("First timestamp of the variable.")
firstTimestamp?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
firstTimestamp?: utcDateTime;

@doc("Last timestamp of the variable.")
lastTimestamp?: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastTimestamp?: utcDateTime;
}

@doc("Detection request.")
Expand All @@ -406,18 +409,21 @@ used in the training phase.
A required field, indicating the start time of data for detection. Should be
date-time.
""")
startTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
startTime: utcDateTime;

@doc("""
A required field, indicating the end time of data for detection. Should be
date-time.
""")
endTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
endTime: utcDateTime;
}

model AnomalyState {
@doc("timestamp")
timestamp: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
timestamp: utcDateTime;
value?: AnomalyValue;

@doc("Error message for the current timestamp")
Expand Down Expand Up @@ -467,10 +473,12 @@ will be used as its variable name.
A required field, indicating the start time of training data. Should be
date-time.
""")
startTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
startTime: utcDateTime;

@doc("A required field, indicating the end time of training data. Should be date-time.")
endTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
endTime: utcDateTime;

@doc("An optional field. The name of the model whose maximum length is 24.")
displayName?: string;
Expand Down Expand Up @@ -553,10 +561,12 @@ model ModelSnapshot {
modelId: string;

@doc("Date and time (UTC) when the model was created.")
createdTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
createdTime: utcDateTime;

@doc("Date and time (UTC) when the model was last updated.")
lastUpdatedTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastUpdatedTime: utcDateTime;

@doc("Model status. One of CREATED, RUNNING, READY, and FAILED.")
status: ModelStatus;
Expand All @@ -575,10 +585,12 @@ model Model {
modelId: string;

@doc("Date and time (UTC) when the model was created.")
createdTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
createdTime: utcDateTime;

@doc("Date and time (UTC) when the model was last updated.")
lastUpdatedTime: offsetDateTime;
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
lastUpdatedTime: utcDateTime;

@doc("""
Training result of a model including its status, errors and diagnostics
Expand Down
Loading

0 comments on commit 48e4eb6

Please sign in to comment.