Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes with array of objects produce incomplete schema #328

Closed
agougousis opened this issue May 11, 2016 · 8 comments
Closed

Attributes with array of objects produce incomplete schema #328

agougousis opened this issue May 11, 2016 · 8 comments

Comments

@agougousis
Copy link

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.

@pksunkara
Copy link
Contributor

@agougousis Can you try the following?

nodes (array[object], fixed)

@agougousis
Copy link
Author

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?

@pksunkara
Copy link
Contributor

Can you try this?

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

@agougousis
Copy link
Author

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

@w-vi
Copy link
Member

w-vi commented May 12, 2016

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

@agougousis
Copy link
Author

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.

@kamihouse
Copy link

kamihouse commented Feb 7, 2018

@agougousis use a fixed-type for this:

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

@tomacf
Copy link

tomacf commented May 15, 2018

+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

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

No branches or pull requests

5 participants