refactor: add an understanding of nullable for swagger gen

This commit is contained in:
Polianin Nikita 2024-02-17 09:07:47 +03:00
parent 84872a5d6d
commit 6396d8a318
9 changed files with 47 additions and 9 deletions

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a campus.
@ -8,11 +10,13 @@ public class CampusBasicInfoResponse
/// <summary>
/// Gets or sets the unique identifier of the campus.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the code name of the campus.
/// </summary>
[Required]
public required string CodeName { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a campus.
@ -8,11 +10,13 @@ public class CampusDetailsResponse
/// <summary>
/// Gets or sets the unique identifier of the campus.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the code name of the campus.
/// </summary>
[Required]
public required string CodeName { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents information about a discipline.
@ -8,10 +10,12 @@ public class DisciplineResponse
/// <summary>
/// Gets or sets the unique identifier of the discipline.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the discipline.
/// </summary>
[Required]
public required string Name { get; set; }
}

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// A class for providing information about an error
@ -9,10 +11,12 @@ public class ErrorResponse
/// The text or translation code of the error. This field may not contain information in specific scenarios.
/// For example, it might be empty for HTTP 204 responses where no content is returned or if the validation texts have not been configured.
/// </summary>
[Required]
public required string Error { get; set; }
/// <summary>
/// In addition to returning the response code in the header, it is also duplicated in this field.
/// Represents the HTTP response code.
/// </summary>
[Required]
public required int Code { get; set; }
}

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a faculty.
@ -8,11 +10,13 @@ public class FacultyDetailsResponse
/// <summary>
/// Gets or sets the unique identifier of the faculty.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the faculty.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a faculty.
@ -8,11 +10,13 @@ public class FacultyResponse
/// <summary>
/// Gets or sets the unique identifier of the faculty.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the faculty.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a group.
@ -8,16 +10,19 @@ public class GroupDetailsResponse
/// <summary>
/// Gets or sets the unique identifier of the group.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the group.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>
/// Gets or sets the course number of the group.
/// </summary>
[Required]
public int CourseNumber { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a group.
@ -8,16 +10,19 @@ public class GroupResponse
/// <summary>
/// Gets or sets the unique identifier of the group.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the group.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>
/// Gets or sets the course number of the group.
/// </summary>
[Required]
public int CourseNumber { get; set; }
/// <summary>

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses;
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents information about a professor.
@ -8,11 +10,13 @@ public class ProfessorResponse
/// <summary>
/// Gets or sets the unique identifier of the professor.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the professor.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>