1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 23:52:50 -05:00

[PM-2196] Improvements to the Swagger generator (#2914)

* Swagger fixes

Co-Authored-By: Oscar Hinton <Hinton@users.noreply.github.com>

* Make Response Models return Guids instead of strings

* Change strings into guids in ScimApplicationFactory

---------

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
This commit is contained in:
Daniel García
2023-07-14 17:18:26 +02:00
committed by GitHub
parent 966614c7e2
commit 4f87e4e1a4
41 changed files with 209 additions and 217 deletions

View File

@ -14,14 +14,14 @@ public class CollectionResponseModel : ResponseModel
throw new ArgumentNullException(nameof(collection));
}
Id = collection.Id.ToString();
OrganizationId = collection.OrganizationId.ToString();
Id = collection.Id;
OrganizationId = collection.OrganizationId;
Name = collection.Name;
ExternalId = collection.ExternalId;
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public Guid Id { get; set; }
public Guid OrganizationId { get; set; }
public string Name { get; set; }
public string ExternalId { get; set; }
}

View File

@ -14,7 +14,7 @@ public class DeviceResponseModel : ResponseModel
throw new ArgumentNullException(nameof(device));
}
Id = device.Id.ToString();
Id = device.Id;
Name = device.Name;
Type = device.Type;
Identifier = device.Identifier;
@ -24,7 +24,7 @@ public class DeviceResponseModel : ResponseModel
EncryptedPrivateKey = device.EncryptedPrivateKey;
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public DeviceType Type { get; set; }
public string Identifier { get; set; }

View File

@ -14,15 +14,15 @@ public class GroupResponseModel : ResponseModel
throw new ArgumentNullException(nameof(group));
}
Id = group.Id.ToString();
OrganizationId = group.OrganizationId.ToString();
Id = group.Id;
OrganizationId = group.OrganizationId;
Name = group.Name;
AccessAll = group.AccessAll;
ExternalId = group.ExternalId;
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public Guid Id { get; set; }
public Guid OrganizationId { get; set; }
public string Name { get; set; }
public bool AccessAll { get; set; }
public string ExternalId { get; set; }

View File

@ -8,12 +8,12 @@ public class InstallationResponseModel : ResponseModel
public InstallationResponseModel(Installation installation, bool withKey)
: base("installation")
{
Id = installation.Id.ToString();
Id = installation.Id;
Key = withKey ? installation.Key : null;
Enabled = installation.Enabled;
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Key { get; set; }
public bool Enabled { get; set; }
}

View File

@ -6,10 +6,10 @@ public class OrganizationAutoEnrollStatusResponseModel : ResponseModel
{
public OrganizationAutoEnrollStatusResponseModel(Guid orgId, bool resetPasswordEnabled) : base("organizationAutoEnrollStatus")
{
Id = orgId.ToString();
Id = orgId;
ResetPasswordEnabled = resetPasswordEnabled;
}
public string Id { get; set; }
public Guid Id { get; set; }
public bool ResetPasswordEnabled { get; set; }
}

View File

@ -13,8 +13,8 @@ public class OrganizationDomainResponseModel : ResponseModel
throw new ArgumentNullException(nameof(organizationDomain));
}
Id = organizationDomain.Id.ToString();
OrganizationId = organizationDomain.OrganizationId.ToString();
Id = organizationDomain.Id;
OrganizationId = organizationDomain.OrganizationId;
Txt = organizationDomain.Txt;
DomainName = organizationDomain.DomainName;
CreationDate = organizationDomain.CreationDate;
@ -24,8 +24,8 @@ public class OrganizationDomainResponseModel : ResponseModel
LastCheckedDate = organizationDomain.LastCheckedDate;
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public Guid Id { get; set; }
public Guid OrganizationId { get; set; }
public string Txt { get; set; }
public string DomainName { get; set; }
public DateTime CreationDate { get; set; }

View File

@ -17,7 +17,7 @@ public class OrganizationResponseModel : ResponseModel
throw new ArgumentNullException(nameof(organization));
}
Id = organization.Id.ToString();
Id = organization.Id;
Name = organization.Name;
BusinessName = organization.BusinessName;
BusinessAddress1 = organization.BusinessAddress1;
@ -55,7 +55,7 @@ public class OrganizationResponseModel : ResponseModel
MaxAutoscaleSmServiceAccounts = organization.MaxAutoscaleSmServiceAccounts;
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public string BusinessName { get; set; }
public string BusinessAddress1 { get; set; }

View File

@ -18,8 +18,8 @@ public class OrganizationUserResponseModel : ResponseModel
throw new ArgumentNullException(nameof(organizationUser));
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Id = organizationUser.Id;
UserId = organizationUser.UserId;
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
@ -37,8 +37,8 @@ public class OrganizationUserResponseModel : ResponseModel
throw new ArgumentNullException(nameof(organizationUser));
}
Id = organizationUser.Id.ToString();
UserId = organizationUser.UserId?.ToString();
Id = organizationUser.Id;
UserId = organizationUser.UserId;
Type = organizationUser.Type;
Status = organizationUser.Status;
AccessAll = organizationUser.AccessAll;
@ -50,8 +50,8 @@ public class OrganizationUserResponseModel : ResponseModel
HasMasterPassword = organizationUser.HasMasterPassword;
}
public string Id { get; set; }
public string UserId { get; set; }
public Guid Id { get; set; }
public Guid? UserId { get; set; }
public OrganizationUserType Type { get; set; }
public OrganizationUserStatusType Status { get; set; }
public bool AccessAll { get; set; }

View File

@ -15,7 +15,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization) : this("profileOrganization")
{
Id = organization.OrganizationId.ToString();
Id = organization.OrganizationId;
Name = organization.Name;
UsePolicies = organization.UsePolicies;
UseSso = organization.UseSso;
@ -46,8 +46,8 @@ public class ProfileOrganizationResponseModel : ResponseModel
Identifier = organization.Identifier;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(organization.Permissions);
ResetPasswordEnrolled = organization.ResetPasswordKey != null;
UserId = organization.UserId?.ToString();
ProviderId = organization.ProviderId?.ToString();
UserId = organization.UserId;
ProviderId = organization.ProviderId;
ProviderName = organization.ProviderName;
ProviderType = organization.ProviderType;
FamilySponsorshipFriendlyName = organization.FamilySponsorshipFriendlyName;
@ -68,7 +68,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
}
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public bool UsePolicies { get; set; }
public bool UseSso { get; set; }
@ -97,9 +97,9 @@ public class ProfileOrganizationResponseModel : ResponseModel
public string Identifier { get; set; }
public Permissions Permissions { get; set; }
public bool ResetPasswordEnrolled { get; set; }
public string UserId { get; set; }
public Guid? UserId { get; set; }
public bool HasPublicAndPrivateKeys { get; set; }
public string ProviderId { get; set; }
public Guid? ProviderId { get; set; }
public string ProviderName { get; set; }
public ProviderType? ProviderType { get; set; }
public string FamilySponsorshipFriendlyName { get; set; }

View File

@ -9,7 +9,7 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
public ProfileProviderOrganizationResponseModel(ProviderUserOrganizationDetails organization)
: base("profileProviderOrganization")
{
Id = organization.OrganizationId.ToString();
Id = organization.OrganizationId;
Name = organization.Name;
UsePolicies = organization.UsePolicies;
UseSso = organization.UseSso;
@ -39,8 +39,8 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
Identifier = organization.Identifier;
Permissions = new Permissions();
ResetPasswordEnrolled = false;
UserId = organization.UserId?.ToString();
ProviderId = organization.ProviderId?.ToString();
UserId = organization.UserId;
ProviderId = organization.ProviderId;
ProviderName = organization.ProviderName;
PlanProductType = StaticStore.GetPasswordManagerPlan(organization.PlanType).Product;
}

View File

@ -20,7 +20,7 @@ public class ProfileResponseModel : ResponseModel
throw new ArgumentNullException(nameof(user));
}
Id = user.Id.ToString();
Id = user.Id;
Name = user.Name;
Email = user.Email;
EmailVerified = user.EmailVerified;
@ -45,7 +45,7 @@ public class ProfileResponseModel : ResponseModel
{
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public bool EmailVerified { get; set; }

View File

@ -10,24 +10,24 @@ public class ProfileProviderResponseModel : ResponseModel
public ProfileProviderResponseModel(ProviderUserProviderDetails provider)
: base("profileProvider")
{
Id = provider.ProviderId.ToString();
Id = provider.ProviderId;
Name = provider.Name;
Key = provider.Key;
Status = provider.Status;
Type = provider.Type;
Enabled = provider.Enabled;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(provider.Permissions);
UserId = provider.UserId?.ToString();
UserId = provider.UserId;
UseEvents = provider.UseEvents;
}
public string Id { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public string Key { get; set; }
public ProviderUserStatusType Status { get; set; }
public ProviderUserType Type { get; set; }
public bool Enabled { get; set; }
public Permissions Permissions { get; set; }
public string UserId { get; set; }
public Guid? UserId { get; set; }
public bool UseEvents { get; set; }
}

View File

@ -16,8 +16,8 @@ public class ProviderUserResponseModel : ResponseModel
throw new ArgumentNullException(nameof(providerUser));
}
Id = providerUser.Id.ToString();
UserId = providerUser.UserId?.ToString();
Id = providerUser.Id;
UserId = providerUser.UserId;
Type = providerUser.Type;
Status = providerUser.Status;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(providerUser.Permissions);
@ -31,15 +31,15 @@ public class ProviderUserResponseModel : ResponseModel
throw new ArgumentNullException(nameof(providerUser));
}
Id = providerUser.Id.ToString();
UserId = providerUser.UserId?.ToString();
Id = providerUser.Id;
UserId = providerUser.UserId;
Type = providerUser.Type;
Status = providerUser.Status;
Permissions = CoreHelpers.LoadClassFromJsonData<Permissions>(providerUser.Permissions);
}
public string Id { get; set; }
public string UserId { get; set; }
public Guid Id { get; set; }
public Guid? UserId { get; set; }
public ProviderUserType Type { get; set; }
public ProviderUserStatusType Status { get; set; }
public Permissions Permissions { get; set; }

View File

@ -11,12 +11,12 @@ public class SelectionReadOnlyResponseModel
throw new ArgumentNullException(nameof(selection));
}
Id = selection.Id.ToString();
Id = selection.Id;
ReadOnly = selection.ReadOnly;
HidePasswords = selection.HidePasswords;
}
public string Id { get; set; }
public Guid Id { get; set; }
public bool ReadOnly { get; set; }
public bool HidePasswords { get; set; }
}

View File

@ -7,10 +7,10 @@ public class UserKeyResponseModel : ResponseModel
public UserKeyResponseModel(Guid id, string key)
: base("userKey")
{
UserId = id.ToString();
UserId = id;
PublicKey = key;
}
public string UserId { get; set; }
public Guid UserId { get; set; }
public string PublicKey { get; set; }
}