ajaynegi45 / LibraryMan-API

Revolutionize book management with LibraryMan! Easily track stock, borrowers, and due dates, streamlining operations for schools, companies, and libraries worldwide, ensuring efficient and organized book lending.
MIT License
44 stars 49 forks source link

Validation of Api Values #81

Closed anishmu20 closed 2 weeks ago

anishmu20 commented 1 month ago

Is this feature already requested?

Problem or Missing Functionality

Currently, the API does not validate user input properly. This means that when users or systems send requests, data is accepted without checks for correctness, format, or constraints. For instance, fields like email addresses, phone numbers, or dates can be incorrectly formatted, leading to inconsistent data being stored in the system.

Feature Description

This feature adds input validation to the API to ensure that data received from client requests adheres to the defined constraints and business rules before processing. By validating inputs, the API can enforce data integrity, prevent invalid data from being persisted to the database, and improve security by mitigating the risk of malicious inputs.

Screenshots

No response

Would you like to work on this feature?

Yes

Implementation Plan

To implement validation in Spring Boot, identify key fields in the DTO classes that require validation, such as required fields (e.g., name, email), formatted fields (e.g., email, phone), and fields with constraints (e.g., age, price, string length). Use standard validation annotations like @NotNull, @Size, @Email, and @Pattern to enforce these rules. Update the DTO classes with these annotations to ensure that all incoming data is validated before reaching the service layer. This helps maintain data integrity, improves user feedback, and prevents invalid data from being processed.

Guhapriya01 commented 1 month ago

@anishmu20, thanks for the detailed implementation plan! Input validation is crucial for ensuring data integrity and security within the API, and I believe this enhancement could significantly improve our system.

I’d like to assign this issue to you for implementation. If you need any assistance while working on this, feel free to reach out!

Guhapriya01 commented 3 weeks ago

Hi @anishmu20! Just wanted to check in and see how the input validation work is going. Let me know if you need any help with the implementation!

anishmu20 commented 3 weeks ago

hii sorry for delay i am working on it will be done in next 2 to 3 days .

Guhapriya01 commented 3 weeks ago

No problem, thanks for the update!