/// <summary>
        ///     Generate the CRD validation schema for a complex data-type.
        /// </summary>
        /// <param name="objectType">
        ///     A <see cref="Type"/> representing the complex (object) data-type.
        /// </param>
        /// <returns>
        ///     The generated <see cref="JSONSchemaPropsV1Beta1"/>.
        /// </returns>
        static JSONSchemaPropsV1Beta1 GenerateObjectSchema(Type objectType)
        {
            if (objectType == null)
            {
                throw new ArgumentNullException(nameof(objectType));
            }

            var schemaProps = new JSONSchemaPropsV1Beta1
            {
                Type        = "object",
                Description = objectType.Name,
            };

            foreach (PropertyInfo property in objectType.GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                if (!(property.CanRead && property.CanWrite))
                {
                    continue;
                }

                // Ignore non-serialised properties.
                if (property.GetCustomAttribute <JsonIgnoreAttribute>() != null)
                {
                    continue;
                }

                // We only want properties declared on KubeCustomResourceV1 (or classes derived from it).
                if (!typeof(KubeCustomResourceV1).IsAssignableFrom(property.DeclaringType))
                {
                    continue;
                }

                schemaProps.Properties[property.Name] = GenerateSchema(property.PropertyType);
            }

            schemaProps.Required.AddRange(
                GetRequiredPropertyNames(objectType)
                );

            return(schemaProps);
        }
        /// <summary>
        ///     Generate the CRD validation schema for an <see cref="Enum"/> data-type.
        /// </summary>
        /// <param name="enumType">
        ///     A <see cref="Type"/> representing the data-type.
        /// </param>
        /// <returns>
        ///     The generated <see cref="JSONSchemaPropsV1Beta1"/>.
        /// </returns>
        static JSONSchemaPropsV1Beta1 GenerateEnumSchema(Type enumType)
        {
            if (enumType == null)
            {
                throw new ArgumentNullException(nameof(enumType));
            }

            JSONSchemaPropsV1Beta1 schema = new JSONSchemaPropsV1Beta1
            {
                Type        = "string",
                Description = enumType.Name
            };

            schema.Enum.AddRange(
                Enum.GetNames(enumType).Select(
                    memberName => new JSONV1Beta1
            {
                Raw = memberName
            }
                    )
                );

            return(schema);
        }