Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Array consisting of specified types only #83

@honzatrtik

Description

@honzatrtik

Hi,
we are struggling with defining MSON, which would describe array consisting of specified types only (we'd like to have included section of our json api (http://jsonapi.org/) responses fully validated by dredd).

So far, we tried this:

## Type1 (object, fixed-type)
+ prop1: `val1` (string)

## Type2 (object, fixed-type)
+ prop2: `val2` (string)

...

+ Response 200 (application/json)
    + Attributes
        + included (array, fixed-type)
            + (Type1)
            + (Type2)

Generated json schema validates this json:

{
  "included": [
    {
      "prop1": ""
    },
   {
      "prop2": ""
    }
  ]
}

but not this one:

{
  "included": [
    {
      "prop1": ""
    },
    {
      "prop1": ""
    },
   {
      "prop2": ""
    }
  ]
}

Another try was something like this:

## Type1 (object, fixed-type)
+ prop1: `val1` (string)

## Type2 (object, fixed-type)
+ prop2: `val2` (string)

...

+ Response 200 (application/json)
    + Attributes
        + included (array, fixed-type)
            + (enum)
                + (Type1)
                + (Type2)

But this seems to generate invalid json schema...

Are we missing something?
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions