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> /// <summary>
/// Represents basic information about a campus. /// Represents basic information about a campus.
@ -8,11 +10,13 @@ public class CampusBasicInfoResponse
/// <summary> /// <summary>
/// Gets or sets the unique identifier of the campus. /// Gets or sets the unique identifier of the campus.
/// </summary> /// </summary>
[Required]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the code name of the campus. /// Gets or sets the code name of the campus.
/// </summary> /// </summary>
[Required]
public required string CodeName { get; set; } public required string CodeName { get; set; }
/// <summary> /// <summary>

View File

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

View File

@ -1,4 +1,6 @@
namespace Mirea.Api.Dto.Responses; using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary> /// <summary>
/// Represents information about a discipline. /// Represents information about a discipline.
@ -8,10 +10,12 @@ public class DisciplineResponse
/// <summary> /// <summary>
/// Gets or sets the unique identifier of the discipline. /// Gets or sets the unique identifier of the discipline.
/// </summary> /// </summary>
[Required]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name of the discipline. /// Gets or sets the name of the discipline.
/// </summary> /// </summary>
[Required]
public required string Name { get; set; } 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> /// <summary>
/// A class for providing information about an error /// 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. /// 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. /// 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> /// </summary>
[Required]
public required string Error { get; set; } public required string Error { get; set; }
/// <summary> /// <summary>
/// In addition to returning the response code in the header, it is also duplicated in this field. /// In addition to returning the response code in the header, it is also duplicated in this field.
/// Represents the HTTP response code. /// Represents the HTTP response code.
/// </summary> /// </summary>
[Required]
public required int Code { get; set; } 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> /// <summary>
/// Represents detailed information about a faculty. /// Represents detailed information about a faculty.
@ -8,11 +10,13 @@ public class FacultyDetailsResponse
/// <summary> /// <summary>
/// Gets or sets the unique identifier of the faculty. /// Gets or sets the unique identifier of the faculty.
/// </summary> /// </summary>
[Required]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name of the faculty. /// Gets or sets the name of the faculty.
/// </summary> /// </summary>
[Required]
public required string Name { get; set; } public required string Name { get; set; }
/// <summary> /// <summary>

View File

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

View File

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

View File

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

View File

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