I may be wrong on this, but I think additionalProperty and allOf parameters should be both defined as OpenAPIV2.SchemaObject; instead, now they are IJsonSchema.
The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the Schema Object definition is used instead.
items
allOf
properties
additionalProperties
While properties field is defined as OpenAPIV2.SchemaObjecthere, and items has its own ItemsObject definition, both additionalProperty and allOf aren't explicitly defined in OpenAPIV2.SchemaObject as they're inherited from IJsonSchema; hence, they are recursively defined as IJsonSchema as well.
This causes issues when modeling nested objects, as they are recursively defined as IJsonSchema, hence having no definition for SchemaObject-specific fields. The following is an example of a valid OA2 declaration which has no mapping in current type definitions:
I may be wrong on this, but I think
additionalProperty
andallOf
parameters should be both defined asOpenAPIV2.SchemaObject
; instead, now they areIJsonSchema
.As for OA2 documentation:
While
properties
field is defined asOpenAPIV2.SchemaObject
here, anditems
has its ownItemsObject
definition, bothadditionalProperty
andallOf
aren't explicitly defined inOpenAPIV2.SchemaObject
as they're inherited fromIJsonSchema
; hence, they are recursively defined asIJsonSchema
as well.This causes issues when modeling nested objects, as they are recursively defined as
IJsonSchema
, hence having no definition forSchemaObject
-specific fields. The following is an example of a valid OA2 declaration which has no mapping in current type definitions:(
$ref
field has no definition inIJsonSchema
).In OA3, you solved the issue by just re-declaring such fields in
OpenAPIV3.BaseSchemaObject
.I don't know if my point is even good, or I am missing something. In case, I can provide a PR to fix this.
Thanks