Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add non required fields filter and CustomDateTime #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TusharAthare
Copy link

@TusharAthare TusharAthare commented Nov 20, 2024

Description

This PR refactors the utility functions in the graphene_django_extras.utils module to enhance flexibility and improve handling of user-defined schema requirements and date-time formats. Specifically:

  • Customizable Non-Required Fields: Users can now provide a list of fields to mark as not required, allowing for more tailored schema definitions.
  • CustomDateTime Functionality: Added support for parsing date-time values in both epoch and standard datetime formats, improving compatibility with varied input formats.

Problem Addressed

  • Rigid Field Requirements: The existing implementation did not allow users to customize field requirements, leading to potential over-specification of fields in schemas.
  • Limited Date-Time Parsing: Handling of date-time values was limited to standard formats, making it challenging to support epoch-based timestamps.

Proposed Solution

  • Refactored utility functions to incorporate a mechanism for skipping non-required fields based on user input.
  • Introduced the CustomDateTime class to seamlessly handle epoch timestamps and standard datetime formats, ensuring flexible and robust date parsing.

Impact

  • Enhanced Flexibility: Provides developers with greater control over schema generation by allowing customization of required fields.
  • Broader Compatibility: Simplifies handling of diverse date-time formats, reducing preprocessing efforts and increasing ease of use.
  • Backward Compatibility: These changes are non-breaking and integrate smoothly with existing setups.

@TusharAthare
Copy link
Author

@eamigo86 Can you please review the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant