示例#1
0
        /// <summary>
        /// Determines wether a path parameter should be wrapped in quotes based on the type of the parameter.
        /// </summary>
        /// <param name="edmType">The type of the parameter.</param>
        /// <param name="settings">The conversion settings.</param>
        /// <returns>True if the parameter should be wrapped in quotes, false otherwise.</returns>
        public static bool ShouldPathParameterBeQuoted(this IEdmType edmType, OpenApiConvertSettings settings)
        {
            if (edmType == null || settings == null || !settings.AddSingleQuotesForStringParameters)
            {
                return(false);
            }

            return(edmType.TypeKind switch
            {
                EdmTypeKind.Enum => true,
                EdmTypeKind.Primitive when edmType.IsString() || edmType.IsTemporal() => true,
                _ => false,
            });