Code Monkey home page Code Monkey logo

Comments (3)

hfaran avatar hfaran commented on June 21, 2024

Hi!

While this is a very good idea; I'm not sure this is something that is easy to integrate into Tornado-JSON, or is a good fit for it.

When I first wrote Tornado-JSON, it was with the intention that it would be used to write relatively simple APIs; hence why I chose JSend as the specification for responses. It seems like you want a much more fully-features specification, such as JSON API. This is difficult to integrate with Tornado-JSON as it stands right now because it is geared towards simplicity.

That being said, this is certainly something that is POSSIBLE to integrate so I would love it if you could provide maybe an example of what the interface or implementation could look like, i.e., how you would go about adding pagination to responses.

from tornado-json.

hfaran avatar hfaran commented on June 21, 2024

If you wanted to implement this yourself, you could simply create your own Mixin class similar to JSendMixin but one which defined a custom standard to your liking and then have an APIHandler class multi-inherit from that. You would also have to implement your own schema.validate method of course.

from tornado-json.

hfaran avatar hfaran commented on June 21, 2024

Going to close this because I don't think this would be in appropriate scope. A very easy way to accomplish this would be to simply add the _meta keyword your actual data response, i.e.,:

{"status": "success", "data": {"_meta": ..., "foo": "bar", ...}}

This would then still fit within the confines of JSend.

from tornado-json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.