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

Invalid JSON schema for fixed-type arrays #389

Closed
paumoreno opened this issue Sep 8, 2016 · 2 comments
Closed

Invalid JSON schema for fixed-type arrays #389

paumoreno opened this issue Sep 8, 2016 · 2 comments

Comments

@paumoreno
Copy link

The following input:

## Test [/Test]

+ Attributes (object)

    + id: 12 (number) - List identifier
    + name: Films you must watch (string, required) - List description
    + medias (array[string], fixed-type) - References to the medias in the list

# GET /
+ Response 200 (application/json)
    + Attributes (Test)

Generates this JSON schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "number",
      "description": "List identifier"
    },
    "name": {
      "type": "string",
      "description": "List description"
    },
    "medias": {
      "type": "array",
      "items": [
        {
          "type": "string"
        }
      ],
      "description": "References to the medias in the list"
    }
  },
  "required": [
    "name"
  ]
}

Note that there is a tuple validation for the medias array.

In this snippet:

      "items": [
        {
          "type": "string"
        }
      ],

The validator is saying "the first item of the array should be a string".

Instead, as I understand from the MSON spec, array[string], fixed-type means that all items of the array should be a string.

The expected output, thus, should be a List Validation schema:

      "items": {
        "type": "string"
      },
@pksunkara
Copy link
Contributor

@goganchic Would you look at this once? Thanks.

@goganchic
Copy link
Contributor

ok, I'll take a look at this bug

@pksunkara pksunkara added the bug label Sep 16, 2016
@kylef kylef added the mson label Sep 16, 2016
w-vi pushed a commit that referenced this issue Oct 4, 2016
pksunkara added a commit that referenced this issue Oct 4, 2016
kylef pushed a commit that referenced this issue Jul 7, 2017
Introduce "direct_dependent_settings" in snowcrash.gyp
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants