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

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 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

1 participant