Git Product home page Git Product logo

jsonapi-fractal's People

Contributors

andersondanilo avatar delerme avatar dependabot[bot] avatar felipemengatto avatar lizzypy avatar r0mm4k avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jsonapi-fractal's Issues

Support has died. See description.

So support for these kind of serialization libraries has died down quite a bit. Moreover, all of them fail to serialize the entire spec...

So over the past few days I've designed a resource-recursive, typescript/javascript library for serializing the entire JSON:API spec. Our API is far more fluent (and obvious) than the one here (and every other serializer I have seen/used). If this serializer doesn't fit your need, you might want to check it out :) Development is active.

If you are in particular struggling with issues such as links, resource relationships, and deep recursion (essentially any of the complicated parts of the JSON:API spec), I strongly recommend moving to our library.

{TS:JAPI}: https://github.com/jun-sheaf/ts-japi

Pluralize relationship types

For example, a new user is about to be created and the role is being referenced. The problem is that in the result of serialization the relationship type is singular ("role"), not plural ("roles").

import { serialize } from 'jsonapi-fractal';

const user = {
  name: 'Jon Snow',
  role: { id: 123 }
};

const jsonApiFormatted = serialize(user, 'users', { relationships: ['role'] });

console.log(JSON.stringify(jsonApiFormatted));

outputs:

{
    "data": {
        "type": "users",
        "attributes": {
            "name": "Jon Snow"
        },
        "relationships": {
            "role": {
                "data": {
                    "type": "role",
                    "id": 123
                }
            }
        }
    }
}

Update Library

Dear @andersondanilo ,
this library seems really easy to use. However, i noticed, that there are several features from json:api missing - for example, errors. Or features are broken, like the options.fields attribute, ...

Are you planning to maintain this library?
All the best,
Johannes

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.