Giter VIP home page Giter VIP logo

json-api-normalize's People

Contributors

dbrekalo 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

Watchers

 avatar  avatar

json-api-normalize's Issues

not support different type array

example

{
"relationships": {
"field_test": {
"data": [
{
"type": "paragraph--image",
"id": "456"
},
{
"type": "paragraph--text",
"id": "123"
}
]
}
}
}

attributes type property it is being overridden

First of all I want to say thank you for creating such neat package ๐Ÿ™‡

Unfortunately I found a little bug using it. As it is stated in the title, If data.attributes contains type property (data.attributes.type) it is being overridden by type in data object (data.type)

As is:

const jsonApiNormalize = require('json-api-normalize');

const input = {
    data: {
        type: 'article', // <--
        id: '1',
        attributes: {
            type: 'other type' // <--

            title: 'JSON API paints my bikeshed!',
            body: 'The shortest article. Ever.',
        },
    },
}

jsonApiNormalize(input).get(['type']);
// returns { type:"article" }

To be:
Should return { type:"other type" }

Not sure how this should be resolved, because there might be situation where data.type is also needed. Maybe some special char should be introduced like $ eg $id would be equal to data.id and $type to data.type

Fetch all fields

Hiho,

thanks for your work!

Just wondering if it would be possible to offer a method that fetches all fields and relations by default?

Something like: normalize(articleJsonApiData).getAll();

Is there a reason why you only implemented get only via specific field names?

Cheers Florian

jsonapi errors array is ignored

Hi,
The package does not keep of any errors that could be returned by the jsonapi endpoint.
I think the best way to handle this would be to keep the errors key in: meta.endpoint.url.errors at the same level the data would be.

Thanks

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.