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

Expose fields such that swagger can autogenerate models/code? #53

Open
shannazf opened this issue Nov 2, 2017 · 2 comments
Open

Expose fields such that swagger can autogenerate models/code? #53

shannazf opened this issue Nov 2, 2017 · 2 comments

Comments

@shannazf
Copy link

shannazf commented Nov 2, 2017

Hi, I'm trying to use Serpy in my project. I have a very simple userprofile model that I'm testing with Serpy, which I have pasted below. I've also included two images that show the django serializer versus serpy, and how that renders in Swagger. Any idea how to make it play nicely with each other?

screen shot 2017-11-02 at 11 15 04 am

screen shot 2017-11-02 at 11 16 06 am

class UserProfileSerializer(serpy.Serializer):
    class Meta:
        model = UserProfile
        fields = (
            'id',
            'user',
            'notes',
            'created_at',
            'updated_at'
        )
        read_only_fields = ('created_at', 'updated_at')

    id = serpy.Field()
    user = serpy.StrField()
    notes = serpy.StrField()
    created_at = serpy.Field()
    updated_at = serpy.Field()
@ahankinson
Copy link
Contributor

I suspect it's related to #1

@sergenp
Copy link

sergenp commented Jan 20, 2022

If you're using Django Rest Framework, I have forked the repo and added swagger auto-gen for drf endpoints using drf-yasg.

You can install it via https://pypi.org/project/drf-serpy/

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

No branches or pull requests

3 participants