private SwaggerParameter CreatePrimitiveParameter(string name, string description, Type type, IList <Attribute> parentAttributes,
                                                          ISchemaResolver schemaResolver, ISchemaDefinitionAppender schemaDefinitionAppender)
        {
            var typeDescription = JsonObjectTypeDescription.FromType(type, parentAttributes, Settings.DefaultEnumHandling);
            var parameterType   = typeDescription.Type.HasFlag(JsonObjectType.Object) ? typeof(string) : type; // object types must be treated as string

            var operationParameter = _schemaGenerator.Generate <SwaggerParameter>(parameterType, parentAttributes, schemaResolver, schemaDefinitionAppender);

            if (parameterType.GetTypeInfo().IsEnum)
            {
                operationParameter.SchemaReference = _schemaGenerator.Generate <JsonSchema4>(parameterType, parentAttributes, schemaResolver, schemaDefinitionAppender);
            }
            else
            {
                _schemaGenerator.ApplyPropertyAnnotations(operationParameter, type, parentAttributes, typeDescription);
            }

            operationParameter.Name          = name;
            operationParameter.IsRequired    = parentAttributes?.Any(a => a.GetType().Name == "RequiredAttribute") ?? false;
            operationParameter.IsNullableRaw = typeDescription.IsNullable;

            if (description != string.Empty)
            {
                operationParameter.Description = description;
            }

            return(operationParameter);
        }
        private SwaggerParameter CreatePrimitiveParameter(string name, string description, Type type, IList <Attribute> parentAttributes,
                                                          ISchemaResolver schemaResolver, ISchemaDefinitionAppender schemaDefinitionAppender)
        {
            var typeDescription = JsonObjectTypeDescription.FromType(type, parentAttributes, Settings.DefaultEnumHandling);

            SwaggerParameter operationParameter;

            if (typeDescription.IsEnum)
            {
                // TODO(incompatibility): We use "schema" even it is not allowed in non-body parameters
                var parameterType = type.Name == "Nullable`1" ? type.GetGenericTypeArguments().Single() : type;
                operationParameter = new SwaggerParameter
                {
                    Type   = typeDescription.Type, // Used as fallback for generators which do not check the "schema" property
                    Schema = _schemaGenerator.Generate <JsonSchema4>(parameterType, parentAttributes, schemaResolver, schemaDefinitionAppender)
                };
            }
            else
            {
                var parameterType = typeDescription.Type.HasFlag(JsonObjectType.Object) ? typeof(string) : type; // object types must be treated as string
                operationParameter = _schemaGenerator.Generate <SwaggerParameter>(parameterType, parentAttributes, schemaResolver, schemaDefinitionAppender);
                _schemaGenerator.ApplyPropertyAnnotations(operationParameter, type, parentAttributes, typeDescription);
            }

            operationParameter.Name          = name;
            operationParameter.IsRequired    = parentAttributes?.Any(a => a.GetType().Name == "RequiredAttribute") ?? false;
            operationParameter.IsNullableRaw = typeDescription.IsNullable;

            if (description != string.Empty)
            {
                operationParameter.Description = description;
            }

            return(operationParameter);
        }