Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion eng/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ if (!($Exclude -contains "Samples"))
$cadlMain = Join-Path $projectDirectory "main.cadl"
$cadlClient = Join-Path $projectDirectory "client.cadl"
$mainCadlFile = If (Test-Path "$cadlClient") { Resolve-Path "$cadlClient" } Else { Resolve-Path "$cadlMain"}
Add-Cadl $projectName $projectDirectory $mainCadlFile "--option @azure-tools/cadl-csharp.generateConvenienceAPI=true --option @azure-tools/cadl-csharp.unreferenced-types-handling=keepAll"
Add-Cadl $projectName $projectDirectory $mainCadlFile "--option @azure-tools/cadl-csharp.generateConvenienceAPI=true"
}
}

Expand Down
1,927 changes: 1,093 additions & 834 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions samples/AnomalyDetector/Generated/Configuration.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@
#nullable disable

using System;
using Azure.Core;

namespace AnomalyDetector.Models
{
/// <summary> Response of getting a model. </summary>
public partial class AnomalyDetectionModel
{
/// <summary> Initializes a new instance of AnomalyDetectionModel. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="createdTime"> Date and time (UTC) when the model was created. </param>
/// <param name="lastUpdatedTime"> Date and time (UTC) when the model was last updated. </param>
/// <exception cref="ArgumentNullException"> <paramref name="modelId"/> is null. </exception>
internal AnomalyDetectionModel(string modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime)
internal AnomalyDetectionModel(DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime)
{
Argument.AssertNotNull(modelId, nameof(modelId));

ModelId = modelId;
CreatedTime = createdTime;
LastUpdatedTime = lastUpdatedTime;
}
Expand Down

This file was deleted.

54 changes: 0 additions & 54 deletions samples/AnomalyDetector/Generated/Models/ModelList.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ namespace AnomalyDetector.Models
public partial class MultivariateDetectionResult
{
/// <summary> Initializes a new instance of MultivariateDetectionResult. </summary>
/// <param name="resultId"> Result identifier, which is used to fetch the results of an inference call. </param>
/// <param name="summary"> Multivariate anomaly detection status. </param>
/// <param name="results"> Detection result for each timestamp. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resultId"/>, <paramref name="summary"/> or <paramref name="results"/> is null. </exception>
internal MultivariateDetectionResult(string resultId, MultivariateBatchDetectionResultSummary summary, IEnumerable<AnomalyState> results)
/// <exception cref="ArgumentNullException"> <paramref name="summary"/> or <paramref name="results"/> is null. </exception>
internal MultivariateDetectionResult(MultivariateBatchDetectionResultSummary summary, IEnumerable<AnomalyState> results)
{
Argument.AssertNotNull(resultId, nameof(resultId));
Argument.AssertNotNull(summary, nameof(summary));
Argument.AssertNotNull(results, nameof(results));

ResultId = resultId;
Summary = summary;
Results = results.ToList();
}
Expand Down
4 changes: 2 additions & 2 deletions samples/AnomalyDetector/Generated/cadl.json
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@
"IsNullable": false
},
"IsRequired": true,
"IsReadOnly": false,
"IsReadOnly": true,
"IsDiscriminator": false
},
{
Expand Down Expand Up @@ -1783,7 +1783,7 @@
"IsNullable": false
},
"IsRequired": true,
"IsReadOnly": false,
"IsReadOnly": true,
"IsDiscriminator": false
},
{
Expand Down
2 changes: 2 additions & 0 deletions samples/AnomalyDetector/multivariate/models.cadl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enum ModelStatus {
model MultivariateDetectionResult {
@doc("Result identifier, which is used to fetch the results of an inference call.")
@key
@visibility("read")
@format("uuid")
resultId: string;

Expand Down Expand Up @@ -309,6 +310,7 @@ epoch.
model AnomalyDetectionModel {
@doc("Model identifier.")
@key
@visibility("read")
@format("uuid")
modelId: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public void WriteSerialization(CodeWriter writer, TypeProvider schema)
switch (schema)
{
case SerializableObjectType objectSchema:
WriteObjectSerialization(writer, objectSchema);
if (objectSchema.IncludeSerializer || objectSchema.IncludeDeserializer)
{
WriteObjectSerialization(writer, objectSchema);
}
break;
case EnumType { IsExtensible: false } sealedChoiceSchema:
WriteEnumSerialization(writer, sealedChoiceSchema);
Expand Down
16 changes: 5 additions & 11 deletions src/AutoRest.CSharp/LowLevel/Output/DpgOutputLibraryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ private void CreateEnums(IDictionary<InputEnumType, EnumType> dictionary, TypeFa
{
foreach (var inputEnum in _rootNamespace.Enums)
{
if (inputEnum.Usage != InputModelTypeUsage.None)
{
dictionary.Add(inputEnum, new EnumType(inputEnum, TypeProvider.GetDefaultModelNamespace(null,_defaultNamespace), "public", typeFactory, _sourceInputModel));
}
dictionary.Add(inputEnum, new EnumType(inputEnum, TypeProvider.GetDefaultModelNamespace(null, _defaultNamespace), "public", typeFactory, _sourceInputModel));
}
}

Expand All @@ -96,13 +93,10 @@ private void CreateModels(IDictionary<InputModelType, ModelTypeProvider> models,

foreach (var model in _rootNamespace.Models)
{
if (model.Usage != InputModelTypeUsage.None)
{
derivedTypesLookup.TryGetValue(model, out var children);
InputModelType[] derivedTypesArray = children?.ToArray() ?? Array.Empty<InputModelType>();
ModelTypeProvider? defaultDerivedType = GetDefaultDerivedType(models, typeFactory, model, derivedTypesArray, defaultDerivedTypes);
models.Add(model, new ModelTypeProvider(model, TypeProvider.GetDefaultModelNamespace(null, _defaultNamespace), _sourceInputModel, typeFactory, derivedTypesArray, defaultDerivedType));
}
derivedTypesLookup.TryGetValue(model, out var children);
InputModelType[] derivedTypesArray = children?.ToArray() ?? Array.Empty<InputModelType>();
ModelTypeProvider? defaultDerivedType = GetDefaultDerivedType(models, typeFactory, model, derivedTypesArray, defaultDerivedTypes);
models.Add(model, new ModelTypeProvider(model, TypeProvider.GetDefaultModelNamespace(null, _defaultNamespace), _sourceInputModel, typeFactory, derivedTypesArray, defaultDerivedType));
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/CADL.Extension/Emitter.Csharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
},
"dependencies": {
"@autorest/csharp": "3.0.0-beta.20221201.1",
"@azure-tools/cadl-autorest": "0.24.0",
"@azure-tools/cadl-azure-core": "0.24.0",
"@azure-tools/cadl-dpg": "0.24.0",
"@cadl-lang/compiler": "0.38.5",
"@azure-tools/cadl-autorest": "0.25.0",
"@azure-tools/cadl-azure-core": "0.25.0",
"@azure-tools/cadl-dpg": "0.25.0",
"@cadl-lang/compiler": "0.39.0",
"@cadl-lang/eslint-config-cadl": "0.5.0",
"@cadl-lang/eslint-plugin": "0.38.0",
"@cadl-lang/library-linter": "0.38.0",
"@cadl-lang/openapi": "0.38.0",
"@cadl-lang/rest": "0.38.0",
"@cadl-lang/versioning": "0.38.0",
"@cadl-lang/eslint-plugin": "0.39.0",
"@cadl-lang/library-linter": "0.39.0",
"@cadl-lang/openapi": "0.39.0",
"@cadl-lang/rest": "0.39.0",
"@cadl-lang/versioning": "0.39.0",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
"json-serialize-refs": "^0.1.0-0"
Expand Down
Loading