private SwaggerParameter CreatePrimitiveParameter(SwaggerService service, string name, string description, Type type, IList <Attribute> parentAttributes, ISchemaResolver schemaResolver) { var schemaDefinitionAppender = new SwaggerServiceSchemaDefinitionAppender(service, Settings.TypeNameGenerator); var schemaGenerator = new RootTypeJsonSchemaGenerator(service, schemaDefinitionAppender, Settings); var typeDescription = JsonObjectTypeDescription.FromType(type, parentAttributes, Settings.DefaultEnumHandling); var parameterType = typeDescription.IsComplexType ? typeof(string) : type; // complex types must be treated as string var operationParameter = new SwaggerParameter(); typeDescription.ApplyType(operationParameter); if (parameterType.GetTypeInfo().IsEnum) { operationParameter.SchemaReference = schemaGenerator.Generate <JsonSchema4>(parameterType, null, parentAttributes, schemaDefinitionAppender, schemaResolver); } 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); }