/// <summary>Try and get the API scalar type by CLR type.</summary>
        /// <typeparam name="TScalar">CLR type to lookup the API scalar type by.</typeparam>
        /// <param name="apiScalarType">The API scalar type if it exists in the API schema, null otherwise.</param>
        /// <returns>True if API scalar type exists in the API schema, false otherwise.</returns>
        public static bool TryGetApiScalarType <TScalar>(this IApiSchema apiSchema, out IApiScalarType apiScalarType)
        {
            Contract.Requires(apiSchema != null);

            var clrType = typeof(TScalar);

            return(apiSchema.TryGetApiScalarType(clrType, out apiScalarType));
        }
        /// <summary>Get the API scalar type by CLR type object.</summary>
        /// <param name="clrType">CLR type object to lookup the API scalar type by.</param>
        /// <returns>The API scalar type in the API schema, otherwise an exception is thrown.</returns>
        /// <exception cref="ApiSchemaException"></exception>
        public static IApiScalarType GetApiScalarType(this IApiSchema apiSchema, Type clrType)
        {
            Contract.Requires(apiSchema != null);
            Contract.Requires(clrType != null);

            if (apiSchema.TryGetApiScalarType(clrType, out var apiScalarType))
            {
                return(apiScalarType);
            }

            // Unable to get API scalar type by the given CLR type.
            var message = $"Unable to get API scalar type [clrType={clrType.Name}] in the API schema, API scalar type was not configured.";

            throw new ApiSchemaException(message);
        }
        /// <summary>Get the API scalar type by API type name.</summary>
        /// <param name="apiName">API type name to lookup the API scalar type by.</param>
        /// <returns>The API scalar type in the API schema, otherwise an exception is thrown.</returns>
        /// <exception cref="ApiSchemaException"></exception>
        public static IApiScalarType GetApiScalarType(this IApiSchema apiSchema, string apiName)
        {
            Contract.Requires(apiSchema != null);
            Contract.Requires(apiName.SafeHasContent());

            if (apiSchema.TryGetApiScalarType(apiName, out var apiScalarType))
            {
                return(apiScalarType);
            }

            // Unable to get API scalar type by the given API name.
            var message = $"Unable to get API scalar type [apiName={apiName}] in the API schema, API scalar type was not configured.";

            throw new ApiSchemaException(message);
        }