[go: nahoru, domu]

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

Rule array-items does not support prefixItems keyword #2646

Open
yethee opened this issue Jun 24, 2024 · 1 comment
Open

Rule array-items does not support prefixItems keyword #2646

yethee opened this issue Jun 24, 2024 · 1 comment
Labels
s/needs-info t/bug Something isn't working

Comments

@yethee
Copy link
yethee commented Jun 24, 2024

Describe the bug
OpenAPI 3.1 inherits data types from JSON Schema 2020-12, where we can use prefixItems keyword to define tuple value, instead of items keyword.
After changes from #2638 we got an error, when schema contains prefixItems:

Schemas with "type: array", require a sibling "items" field

To Reproduce

test.yaml:

---
openapi: "3.1.0"
components:
  schemas:
    IssueWithPrefixItems:
      type: array
      prefixItems:
        - type: string
        - type: integer
      minItems: 2
      maxItems: 2
      additionalItems: false

Run validation:

npx @stoplight/spectral-cli lint test.yaml

5:26    error  array-items            Schemas with "type: array", require a sibling "items" field  components.schemas.IssueWithPrefixItems

Expected behavior
Field items should not be required when prefixItems field is defined.

Environment (remove any that are not applicable):

npm ls @stoplight/spectral-rulesets

`-- @stoplight/spectral-cli@6.11.1
  +-- @stoplight/spectral-ruleset-bundler@1.5.2
  | `-- @stoplight/spectral-rulesets@1.19.1 deduped
  `-- @stoplight/spectral-rulesets@1.19.1

Additional context
This issue related to #2638.

@ponelat
Copy link
ponelat commented Aug 23, 2024

@mnaumanali94 this sounds like a bug. Where OAS 3.1, supports prefixItems, items, unevaluatedItems or contains (more?).

@ponelat ponelat added s/needs-info t/bug Something isn't working p/medium and removed p/medium labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s/needs-info t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants