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

Feat format decorator #38

Merged
merged 4 commits into from
Apr 18, 2023
Merged

Conversation

bigpe
Copy link
Contributor

@bigpe bigpe commented Apr 15, 2023

The decorator allows you to specify the format of the field, for specific cases

Example

class OtherSerializer(serializers.Serializer):
    custom_format = serializers.SerializerMethodField()

    @ts_format('email')
    def get_custom_format(self, instance) -> str:
        return 'test@email.com'

Output

export interface OtherSerializer {
    /**
    * @format email
    */
    custom_format?: string;
}

@bigpe
Copy link
Contributor Author

bigpe commented Apr 15, 2023

@adenh93 Now I have done everything I wanted, further it can only be improved, I left notes in the code where it can be done better

@adenh93
Copy link
Owner

adenh93 commented Apr 18, 2023

@bigpe haha awesome, I'll get this one merged for you!

@adenh93 adenh93 merged commit 44fb59e into adenh93:master Apr 18, 2023
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.

None yet

2 participants