fortunejs / fortune-json-api

JSON API serializer for Fortune.
MIT License
63 stars 28 forks source link

Attributes missing by included object #50

Closed bliet closed 7 years ago

bliet commented 7 years ago

My Model:

const store = fortune({
    swot: {
        name: String,
        createdAt: Date,
        createdBy: [ 'user', 'boards'],
        postits: [ Array('postit'), 'swot']
    },
    postit: {
        headline: String,
        text: String,
        createdAt: Date,
        createdBy: [ 'user', 'postits' ],
        swot: [ 'swot', 'postits'],
...

I want to read a swot object with postits included.

URL: ...:8080/swots/JiKOS26X3cgXaCMFrcrY?include=postits

...
"included": [
    {
      "type": "postits",
      "id": "j8SP8VJzdCldUoD0yMCt",
      "relationships": {
        "created-by": {
          "links": {
            "self": "/postits/j8SP8VJzdCldUoD0yMCt/relationships/created-by",
            "related": "/postits/j8SP8VJzdCldUoD0yMCt/created-by"
          }
        },
        "swot": {
          "links": {
            "self": "/postits/j8SP8VJzdCldUoD0yMCt/relationships/swot",
            "related": "/postits/j8SP8VJzdCldUoD0yMCt/swot"
          }
        },
        "guiinfo": {
          "links": {
            "self": "/postits/j8SP8VJzdCldUoD0yMCt/relationships/guiinfo",
            "related": "/postits/j8SP8VJzdCldUoD0yMCt/guiinfo"
          }
        }
      },
      "links": {
        "self": "/postits/j8SP8VJzdCldUoD0yMCt"
      }
    }
...

Why are the attributes missing?

gr0uch commented 7 years ago

This was most likely a bug that was fixed in this commit https://github.com/fortunejs/fortune/commit/b18c07f8681f1217f991d2a56b6e9ac76961ec93

Please update to the latest version, and let me know if the bug still exists.

bliet commented 7 years ago

Yes, it works. Many thanks.