/// <summary>
        /// Write the <see cref="IOpenApiAny"/> value.
        /// </summary>
        /// <typeparam name="T">The Open API Any type.</typeparam>
        /// <param name="writer">The Open API writer.</param>
        /// <param name="any">The Any value</param>
        public static void WriteAny <T>(this IOpenApiWriter writer, T any) where T : IOpenApiAny
        {
            if (writer == null)
            {
                throw Error.ArgumentNull(nameof(writer));
            }

            if (any == null)
            {
                writer.WriteNull();
                return;
            }

            switch (any.AnyType)
            {
            case AnyType.Array:     // Array
                writer.WriteArray(any as OpenApiArray);
                break;

            case AnyType.Object:     // Object
                writer.WriteObject(any as OpenApiObject);
                break;

            case AnyType.Primitive:     // Primitive
                writer.WritePrimitive(any as IOpenApiPrimitive);
                break;

            case AnyType.Null:     // null
                writer.WriteNull();
                break;

            default:
                break;
            }
        }