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

Fixed array with a mixin inside produces incorrect json schema #786

Open
Ge11ert opened this issue Jun 22, 2020 · 0 comments
Open

Fixed array with a mixin inside produces incorrect json schema #786

Ge11ert opened this issue Jun 22, 2020 · 0 comments

Comments

@Ge11ert
Copy link

Ge11ert commented Jun 22, 2020

Suppose we have the next apib:

# My API

# Group Example

# GET /

+ Response 200 (application/json)
    + Attributes (array, fixed)
        + Karlin
        + Include Address

# Data Structures

## Address (array)
+ Prague
+ Wendy's

It produces the next json schema, which looks like a bug:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "minItems": 2,
  "items": [
    {
      "const": "Karlin"
    },
    {
      "type": "array",
      "minItems": 2,
      "items": [
        {
          "const": "Prague"
        },
        {
          "const": "Wendy's"
        }
      ],
      "additionalItems": false
    }
  ],
  "additionalItems": false
}

Expected result:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "minItems": 3,
  "items": [
    {
      "const": "Karlin"
    },
    {
      "const": "Prague"
    },
    {
      "const": "Wendy's"
    },
  ],
  "additionalItems": false
}

Produced body is correct:

[
  "Karlin",
  "Prague",
  "Wendy's"
]

Used environment:

$ drafter -v
v5.0.0
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

1 participant