ninja-schema icon indicating copy to clipboard operation
ninja-schema copied to clipboard

What is the difference between this ninja-schema and django-ninja model schema

Open DrJfrost opened this issue 1 year ago • 4 comments

As the title says I find a little redundant to recreate the modelchema

https://django-ninja.dev/guides/response/django-pydantic/ shouldn't the original django-ninja modelschema be used?

DrJfrost avatar Aug 03 '24 02:08 DrJfrost

@DrJfrost ninja-schema compiles to django model fields to pydantic fields with validations based on the field in question. For example, an email field won't result to just a string type pydantic field but also a string type with email validation

eadwinCode avatar Aug 18 '24 10:08 eadwinCode

There are other features too if you check the readme.md

eadwinCode avatar Aug 18 '24 10:08 eadwinCode

wouldn't it be better to extend the ninja's buitlin modelschema? from a large project perspective having to install 3 extra packages just to set up a rest api seems a bit too much. or at least make it part of the ninja-extra setup. if the project is oriented to be django friendly it should then inherently include all the tools in it. just like DRF does with views viewset's modelviewset etc

DrJfrost avatar Aug 20 '24 18:08 DrJfrost

@DrJfrost I think it's a good idea to move it into the django-ninja extra. Thanks for the suggestions. It will be done in future releases of django-ninja extra

eadwinCode avatar Aug 21 '24 07:08 eadwinCode