Skip to content
This repository has been archived by the owner on Jun 23, 2019. It is now read-only.

dataStructure?.toValue() #18

Closed
tu1ly opened this issue Sep 6, 2016 · 4 comments
Closed

dataStructure?.toValue() #18

tu1ly opened this issue Sep 6, 2016 · 4 comments

Comments

@tu1ly
Copy link

tu1ly commented Sep 6, 2016

 return this.content && this.content.toValue();
                                            ^
TypeError: Object [object Object] has no method 'toValue'
    at DataStructure.toValue (/home/towdie/Data/work/horsehead/node_modules/minim-parse-result/node_modules/minim-api-description/lib/elements/data-structure.js:32:45)

@smizell
Copy link
Contributor

smizell commented Sep 6, 2016

@tu1ly would you be able to provide some sample data to create this error? We have tests to cover this function, however, since Minim or this library has no guards against bad values, you don't get any errors until you try to call one of these methods.

@tu1ly
Copy link
Author

tu1ly commented Sep 6, 2016

@smizell

{
  "content": [
    {
      "content": [
        {
          "content": {
            "key": {
              "content": "data",
              "_storedElement": "string",
              "_attributes": {
                "content": [
                  {
                    "content": {
                      "key": {
                        "content": "sourceMap",
                        "_storedElement": "string"
                      },
                      "value": {
                        "_meta": {
                          "content": [],
                          "_storedElement": "object"
                        },
                        "_attributes": {
                          "content": [],
                          "_storedElement": "object"
                        },
                        "content": [
                          {
                            "content": [
                              [
                                1960,
                                15
                              ]
                            ],
                            "_storedElement": "sourceMap"
                          }
                        ],
                        "_storedElement": "array"
                      }
                    },
                    "_storedElement": "member"
                  }
                ],
                "_storedElement": "object"
              }
            },
            "value": {
              "_storedElement": "Session"
            }
          },
          "_storedElement": "member"
        }
      ],
      "_storedElement": "object"
    }
  ],
  "_storedElement": "dataStructure"
}

@tu1ly
Copy link
Author

tu1ly commented Sep 6, 2016

mson:

### Create a new Session [POST]

Request a new session ID.

+ Response 201 (application/vnd.api+json)
    + Headers

            Location: /api/v1/sessions/{session_id}

    + Attributes
        - data (Session)

@kylef
Copy link
Member

kylef commented Apr 28, 2017

This is a problem in Drafter itself, Drafter is serialising the data structures content inside an array. The content should be an element and not an array. Linking in #25 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants