OpenAPITools / OpenAPITools/openapi-generator
[BUG] Erroneous error expecting `items` field on component schema
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am trying to generate client code for a schema, but it gives me an error saying
attribute components.schemas.Config.items is missing
This is confusing to me, as the 3.0.3 spec says:
items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
The type is not array, so I do not understand why it claims it is missing.
openapi-generator version
openapi-generator-cli 5.3.0
commit : bb124e1
built : 2021-10-24T14:50:41Z
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/
OpenAPI declaration file content or url
openapi: '3.0.3'
info:
version: 1.0.0
title: Minimal Repro
paths:
/ping:
get:
responses:
'200':
description: OK
components:
schemas:
Config:
title: Config
type: object
properties:
myProperty:
type: array
default: [a, b, c]
Steps to reproduce
- Try to validate the above spec
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal OpenAPI 3.0.3 YAML in the issue and reproduce the validation error using openapi-generator-cli 5.3.0. Trace the schema validation path for components.schemas.Config and its array property; done means the valid non-array schema no longer reports a missing items field and the reproduction is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100