Package: drf-schema-adapter
DRF-schema-adapterdrf-schema-adapteris a set of tools used to make it as straight-forward to declare an API endpoint
as it is to declare a newModelAdminin Django and export the corresponding definition to frontend
frameworks and libraries.Compatibility MatrixDRF-schema-adapteris compatible with the following matrixPy 3.8Py 3.9Py 3.10Py 3.11Django 3.2DRF 3.12+DRF 3.12+N/AN/ADjango 4.0DRF 3.12+DRF 3.12+DRF 3.12+N/ADjango 4.1DRF 3.12+DRF 3.12+DRF 3.12+DRF 3.12+:warning: For Python 2.7 or Django 1.x support, please use versions 1.x or prior
:warning: For Django Version 3.1 or prior, use version 2.x:warning: For Python 3.11 compatibility, you will have (for now) to install Inflector directly from the repo:pipinstallgit+https://github.com/ixmatus/inflector@ef5c19dc2aa8df5e6b4c452ff2d9b54ec41a04a8#egg=InflectorInstallationWith pippipinstalldrf-schema-adapterIf you are using python 3.11, you will have to also install Inflector directly from the repo, pending the release of Inflector 3.0.2pipinstallgit+https://github.com/ixmatus/inflector@ef5c19dc2aa8df5e6b4c452ff2d9b54ec41a04a8#egg=InflectorFrom sourceWithin the source directory:pythonsetup.pyinstallDemo applicationYou can see a demo application running athttps://djembersample.pythonanywhere.com/.Basic usageFirst of all you'll need to import the default EndpointRouter in your urls.py file.fromdrf_auto_endpoint.routerimportrouterAs well as add its urls to yoururlpatternsinurls.py, the same way you would with DRF'sDefaultRouter.urlpatterns=[...path("api/",include(router.urls)),...]PrototypingThe quickest way to get a working endpoint is to register a model with the router. Register accepts
an optional keyword argument for theurlassociated to that endpoint. By default the url for an
endpoint willbeapp_label/verbose_name_pluralfromdjango.urlsimportinclude,pathfromdrf_auto_endpoint.routerimportrouterfrommy_app.modelsimportMyModel,OtherModelrouter.register(MyModel)router.register(OtherModel,url='my_custom_url')urlpatterns=[path("api/",include(router.urls)),]Adding schema information to yourOPTIONScallsDjango REST framework provides the ability to customize those calls thanks tometadata classes.Setup DRF to use one ofDRF-schema-adapter's metadata classes to get schema information:## settings.py...REST_FRAMEWORK={'DEFAULT_METADATA_CLASS':'drf_auto_endpoint.metadata.AutoMetadata',}Exporting to the frontendFirst add'export_app'to your setting'sINSTALLED_APPS, then run:./manage.pyexport--adapter_nameEmberAdaptersamples/productsFull documentationFor much more complete documentation, please see:http://drf-schema-adapter.readthedocs.ioRelated projectsDjango:Django Rest FrameworkDRF-Base64Ember:ember-cli-dynamic-modelember-cli-cruditiesAngular:angular-formlyReact:nothing so farThird-party adapters:nothing so farContibuting guide-linesIf you'd like to contibute toDRF-schema-adapter*, you are more than welcome to do so. In order to
make contributing to this project a rich experience for everyone, please follow these guide-lines:First, fork the project with your own GitHub account, build your code on your own repository and
submit a pull-request once your contribution is ready.Before contributing a bug-fix or new feature, create an issue explaining what the problem/need is
first. When submitting your pull-request, make sure to reference the original issue.For any code you contribute, make sure to follow PEP8 recommendation (soft line-limit 100, hard
limit 120).For bug-fixes, please first write a test that will fail with the current code and passes using your
patch. For easier evaluation, please do so in 2 separate commitsFor new features, if your feature can be implemented as a third-party app (like new adapters), please
don't contribute them to this repo, publish your own application and open an issue telling us about it.
We will make sure to add a link to your application in this README.Read and respect theCode Of ConductToDoWrite better documentationWrite more/better testsLicense information availablehere.Contributors code of conduct is availablehere. Note that this COCwillbe enforced.