Api-blueprint: Attributes with array of objects produce incomplete schema

Created on 11 May 2016  路  8Comments  路  Source: apiaryio/api-blueprint

The following part of my text file:

  • Response 200 (application/json)

    • Attributes (object)

    • nodes (array[object])



      • id: 4 (number)


      • sname: Chromista (string) - The scientific name


      • rank: Kingdom (string) - The taxonomic rank of the scientific name


      • authorship: noworms, 1603 (string) - Authorship information about the scientific name



    • Body

```
{
    "nodes": [
        {
            "id": "1",
            "sname": "Animalia",
            "rank": "Kingdom",
            "authorship": "noworms, 1603"
        },
        {
            "id": "2",
            "sname": "Archaea",
            "rank": "Kingdom",
            "authorship": "noworms, 1603"
        },
        {
            "id": "3",
            "sname": "Bacteria",
            "rank": "Kingdom",
            "authorship": "noworms, 1603"
        },
        {
            "id": "4",
            "sname": "Chromista",
            "rank": "Kingdom",
            "authorship": "noworms, 1603"
        },
        {
            "id": "5",
            "sname": "Fungi",
            "rank": "Kingdom",
            "authorship": "noworms, 1603"
        }
    ],
    "hasMore": 1
}
```

Produces this HTML:

pic1

The part of schema inside the ""nodes" is missing! Why?
I have also tried to use data structures but the schema remains incomplete.

Most helpful comment

Can you try this?

+ nodes (array, fixed)
    + (object)
        + id: 4 (number)

All 8 comments

@agougousis Can you try the following?

nodes (array[object], fixed)

Ok! Though I haven't found yet where this "fixed" world came from, now the schema is complete.
However, it seems that the produced schema is not right.
The schema produced is:

pic3

and the correct schema should be:

pic4

Am I wrong?

Can you try this?

+ nodes (array, fixed)
    + (object)
        + id: 4 (number)

Yeap! A lot better! I didn't think that "anonymous" objects can be defined!
I am not sure, but I think that the brackets marked in the following screenshot should not be there. What do you think?
schema

@agougousis The brackets are correct as items is an array of possible types

I don't remember very well the rules, but in http://jsonschema.net/ (a quick and dirty solution that I use from time to time) when i give the json data as input it gives me the schema without these brackets.

@agougousis use a fixed-type for this:

+ nodes (array, fixed-type)
    + (object)
        + id: 4 (number)

+1 for the fixed-type

fixed - instance of this type structure and values are fixed. This attribute propagates to Nested Member Types.

fixed-type - instance of this type structure is fixed, value is not. This attribute does not propagate to Nested Member Types.

https://apiblueprint.org/documentation/mson/specification.html#353-type-attribute

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mootpointer picture mootpointer  路  4Comments

fgblomqvist picture fgblomqvist  路  3Comments

pete001 picture pete001  路  6Comments

alronlam picture alronlam  路  4Comments

AlexKorovyansky picture AlexKorovyansky  路  4Comments