Skip to content

Commit

Permalink
fix(generator): do not keep azure.core models
Browse files Browse the repository at this point in the history
Even the accessibility is set, we should not keep them since they should be referenced from Azure.Core

resovle Azure#4597
  • Loading branch information
archerzz authored and Mingzhe Huang (from Dev Box) committed Apr 18, 2024
1 parent 05d2bb3 commit 389bf59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ internal sealed class ModelTypeProvider : SerializableObjectType
protected override bool IsAbstract => !Configuration.SuppressAbstractBaseClasses.Contains(DefaultName) && _inputModel.DiscriminatorPropertyName is not null && _inputModel.DiscriminatorValue is null;

public ModelTypeProviderFields Fields => _fields ??= EnsureFields();

public string? Namespace => _inputModel.Namespace;

private ConstructorSignature InitializationConstructorSignature => _publicConstructor ??= EnsurePublicConstructorSignature();
private ConstructorSignature SerializationConstructorSignature => _serializationConstructor ??= EnsureSerializationConstructorSignature();

Expand Down
2 changes: 1 addition & 1 deletion src/AutoRest.CSharp/LowLevel/AutoRest/DpgOutputLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public DpgOutputLibrary(string libraryName, IReadOnlyDictionary<InputEnumType, E

private IEnumerable<string>? _accessOverriddenModels;
public IEnumerable<string> AccessOverriddenModels => _accessOverriddenModels ??= Enums.Where(e => e.IsAccessibilityOverridden).Select(e => e.Declaration.Name)
.Concat(Models.Where(m => m.IsAccessibilityOverridden).Select(m => m.Declaration.Name));
.Concat(Models.Where(m => m.IsAccessibilityOverridden && (m.Namespace == null || !m.Namespace.StartsWith("Azure.Core"))).Select(m => m.Declaration.Name));

private AspDotNetExtensionTypeProvider? _aspDotNetExtension;
public AspDotNetExtensionTypeProvider AspDotNetExtension => _aspDotNetExtension ??= new AspDotNetExtensionTypeProvider(RestClients, Configuration.Namespace, _sourceInputModel);
Expand Down

0 comments on commit 389bf59

Please sign in to comment.