django tastypie support for mashery iodocs? - django

Mashery iodocs is a tool for documenting API. It needs two configuration json objects to run. It would be nice to have this objects generated automatically by tastypie. Tastypie can generate json with schema, however it's incompatible with iodocs expectations. Any ideas of how to generate this configurtion automatically using tastypie?

Presently, I do not believe there is a way to generate that kind of documentation from TastyPie directly. However, I have found this project useful in creating interactive API documentation.
https://github.com/Hipo/Django-API-Playground

One more project to generate documentation automatically - https://github.com/minism/django-tastypie-swagger
Though so far I haven't find anything convincing!

Related

Graphql Wrapper for Rest APIs with Django

Trying to implement wrapper for existing REST APIS using Django graphQL.
Found similar one in JS but not in Django.
https://graphql.org/blog/rest-api-graphql-wrapper/
Could anyone please suggest if there is a GraphQL Django wrapper for REST calls. Haven't found in documentation either
Are you talking about a rest API using DRF? I'd suggest you look at graphene-django-cud to help you with mutations. Graphene-django is required for this, and will help with your queries. Unfortunately it's not a wrapper that will convert all your DRF code into graphql, however you should be able to basically copy paste a lot of the content in your serializers/views.

Django backend in Rest-framework resource for eCommerce

I want to create an eCommerce store's entire backend in django (using Restful framework APIs), I am looking for resource available online especially on github.
Ofcourse I have done extensive research but I am unable to find anything that is recently updated and yet simple enough for me to understand, as I am not expert in django yet.
All I want is a resource from where I can see overall flow and model it by using their models, views, serializers and permissions as a reference
You can refer here: https://djangopackages.org/grids/g/ecommerce/
I recommend this resource for using: https://github.com/mirumee/saleor
Consult the following list for possible options:
https://github.com/wsvincent/awesome-django#ecommerce
This resource might be helpful to you in the future as well.

Wagtail and Django-Tenants, does it work together?

Does anyone have experience in this topic? Is it fully incompatible or might it be possible to customize certain parts of the app to make it work.
multi-tenancy is not yet fully supported by Wagtail.
Although, as mentioned here in docs, there are some features that are supported.
You may find this blog helpful. Also here is a repository that implements basic features of multi tenancy with django and wagtail and you can play around with it.
Here are some other CMS (build on top of Django) you can try.
I think as long as there are no raw sql queries in wagtail's source code we are good to use django-tenents, the layer that django-tenets is working on is on top of django orm it self.
see wagtail-tenents

Does graphene-django dynamically create an API documentation?

I'm considering using GraphQL with a Django backend service but I couldn't find much information regarding the API documentation. I need some solution to dynamically generate the documentation, perhaps like npm's graphql-docs with a result similar to GitHub's API docs.
Is it feasible to accomplish with graphene-django? If not, what's a good alternative for a python environment?
Yes, it's very easy to do by using GraphiQL, which is embedded in to Graphene.
The instructions on how to integrate this with Graphene are here in the graphene-python documentation. --- basically you need to add the parameter graphiql=True when setting up the API route in your urls.py file.
After it is set up, if go to your API endpoint in your browser, you'll see a nice interface for sending API calls, getting API responses, and reading documentation for both queries and mutations. The documentation is initially hidden on the right until you click on the "< Docs" link.

Django Swagger and JSON API render issues

Using django-rest-framework-json-api I am able to create API end points that work as described within the documentation. Attempted to provide API documentation using django-rest-swagger is not so easy.
1: Swagger uses media_type = 'application/json' which is not supported in the JSON API. To get around this I created a second render class (renderer_classes) that sub classes the JSON API JSONRenderer and forces the media type.
Now the end point supports application/json and application/vnd.api+json and swagger is happy to render in JSON API document structure. Aware that the generated curl requests have none a standard JSON API header.
2: Swagger has the same issue with the parser. While the work out from issue 1 does work there is a secondary challenge. Swagger renders a flat dictionary of field names which is not JSON API and ultimately is requested by DRF.
Is it possible to get swagger to parse in JSON API? At the moment Swagger is not working for PUT or POST.
djangorestframework-jsonapi==2.2.0
djangorestframework==3.5.4
Django==1.11.2
coreapi==2.3.1
python 3.6
Answering my own question here so that others can gain value from what was learnt. We never found a solution to this issue and we did not have the time available to contribute to this project. In general the project also appears to be struggling, maybe due to people like us not contributing...
An alternative project drf-yasg has now emerged, which did not exist at the time of this original posting. drf-yasg was relatively easy to deploy and solved all of our issues so we have now migrated to this project instead.
So if you a looking for swagger api documentation for JSON API endpoints created within DRF, then I would suggest drf-yasg.
At the time of writing JSON API is not supported out of the box, but there is sample code to get it up and running relatively easily. With this change in place, all of the endpoints will be auto documented.
This Github Gist that contains the code from our app, hope that this helps you out until this feature is fully developed.
As you pointed out in your own answer there is an alternative: drf-yasg. This is great package but does not support JSON API schema out of the box.
That's way you'd even better use drf-yasg-json-api that adds JSON API support to drf-yasg by providing all necessary field inspectors, you just need to slightly extend your SWAGGER_SETTINGS.
Check drf-yasg-json-api Github repo for details.
Disclaimer: I am the author of this package.