OpenAPI.NET icon indicating copy to clipboard operation
OpenAPI.NET copied to clipboard

Nullable structured types/Entities/Enums are not supported for spec version 2

Open mispeer opened this issue 6 years ago • 0 comments

Short summary (3-5 sentences) describing the issue. Currently when choosing to serialize to OpenApiSpec version 2 complex, entity, and enum types have null references. For Enums and Entities, this is always true. This is only true for Structured types when they are nullable.

Assemblies affected

Reader Which assemblies and versions are known to be affected? All, as the Reader itself is impacted

Steps to reproduce

Have any nullable complex type and set the spec version to v2. When serialized, those properties that are complex types will be empty. The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue.

Expected result

Serialized with a ref What would happen if there wasn't a bug.

Actual result

Empty What is actually happening.

Additional detail

This issue is due to the generator always creating the references using "AnyOf". This is correct for OpenApiSpec v3, but v2 does not support AnyOf (or Nullable) and when sent to be serialized these nodes will be left empty. *Optional, details of the root cause if known.

mispeer avatar May 30 '19 20:05 mispeer