You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think this is a bug. The parser in the IDE I use (JetBrains PyCharm) also spits out an error saying the required field needs at least one item.
If you don't have any required fields, don't add required.
The OpenAPI spec section on the Schema object says:
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12.
The JSON Schema Validation spec says of the required property:
The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique.
An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
Omitting this keyword has the same behavior as an empty array.
... which makes pretty clear that specifying an empty array for required is supported by JSON Schema, and thus by OpenAPI, and thus should be supported by this tool's model of OpenAPI.
Activity
dbanty commentedon Aug 11, 2022
Sure sounds like a bug 🐛. Thanks for reporting!
joaonc commentedon Sep 3, 2024
I don't think this is a bug. The parser in the IDE I use (JetBrains PyCharm) also spits out an error saying the
requiredfield needs at least one item.If you don't have any required fields, don't add
required.This ticket can be closed, imo.
benweint commentedon Oct 27, 2024
The OpenAPI spec section on the
Schemaobject says:The JSON Schema Validation spec says of the
requiredproperty:... which makes pretty clear that specifying an empty array for
requiredis supported by JSON Schema, and thus by OpenAPI, and thus should be supported by this tool's model of OpenAPI.Allow required fields list to be specified as empty (resolves openapi…
fix: allow required fields list to be specified as empty
fix: allow required fields list to be specified as empty
fix: allow required fields list to be specified as empty (openapi-gen…
fix: allow required fields list to be specified as empty (#651) (#1149)
Release 0.21.7 (#1151)
fix: allow required fields list to be specified as empty (openapi-gen…
Release 0.21.7 (openapi-generators#1151)