Code Monkey home page Code Monkey logo

Comments (5)

EmCousin avatar EmCousin commented on September 2, 2024 1

@rromanchuk I think you might be interested by this branch I've been working on. There is also an open pull request but it needs some testing and some reviews before merging.

When you have time, would you let me know if it is any close to answer your question?

# Gemfile
gem 'grape_fast_jsonapi', git: 'git://github.com/EmCousin/grape_fast_jsonapi.git', branch: 'feature/swagger_model_parser'

from grape-jsonapi.

EmCousin avatar EmCousin commented on September 2, 2024

Hi @rromanchuk, unfortunately I haven't found any simple way to provide such support.
The Best way that I have figured is to code a custom model parser that would take a serializer (including Jsonapi::ObjectSerializer), get its attributes and returns a hash containing the schema with its attributes.

But the big problem with this approach is : Impossible to figure the attribute type directly from the serializer. If your serializer serializes a database model, then we have to manage the dependencies with the different ORMs... like you said, that's a headache.

I'll keep you posted if I manage to find a better solution, meanwhile, feel free to share any ideas you might have on that matter

from grape-jsonapi.

rromanchuk avatar rromanchuk commented on September 2, 2024

@EmCousin that's what i figured. i know it kind of defeats the entire purpose, but i'm almost tempted to make non-jsonapi decorator just for documentation purposes, although good luck to me keeping that maintained.

In context of my client code, the jsonapi response is actually obfuscated away and is flattened to be used in mapping the local object graph. I'm basically just trying to avoid (or non backend developers) having to look at serializer files to look at which properties/datatypes are returned. I mean i might be even overthinking it, i think swagger has an example property where i could even generate fixtures with a simple rake task and render some examples via fixtures. Right now i basically just execute the API call and inspect the live results/dump responses from client console/read the serializer.

from grape-jsonapi.

rromanchuk avatar rromanchuk commented on September 2, 2024

sweet, looking now!

from grape-jsonapi.

rromanchuk avatar rromanchuk commented on September 2, 2024

closing, tracked in #5

from grape-jsonapi.

Related Issues (11)

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.