Repository: lukeautry/tsoa (ts)

Issue:
any type incorrectly generates object requirement
## Sorting

* **I'm submitting a ...**
  - [x] bug report
  - [ ] feature request
  - [ ] support request

* I confirm that I
  - [x] used the [search](https://github.com/lukeautry/tsoa/search?type=Issues) to make sure that a similar issue hasn't already been submit

## Expected Behavior
Usage of any should not generate a type requirement and explicitly allow additional props.
```ts
 export type Test = any;
```
```json
"Test": {
    "additionalProperties": true
}
```

## Current Behavior
Currently, a type of "object" is generated. This means that only object properties are allowed.
```ts
 export type Test = any;
```
```json
"Test": {
    "additionalProperties": true,
    "type": "object"
}
```

## Detailed Description
The any (and unknown) type can by definition accept any input, therefore it does not make sense to generate a type specifier. While usage of any is generally discouraged, there are a few cases where it is useful.

For example, allowing free form JSON input for sending messages.
```ts
export interface SendMessageInput {
    topic: string;
    message: {[key: string]: any};
}
```



Pull request:
Remove object type from any and unknown definitions
### All Submissions:

* [x] Have you followed the guidelines in our [Contributing](https://github.com/lukeautry/tsoa/tree/master/docs/CONTRIBUTING.md) document?
* [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/lukeautry/tsoa/pulls) for the same update/change?
* [x] Have you written unit tests?
* [ ] Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
* [x] This PR is associated with an existing issue?

**Closing issues**
closes #625 

Patch:
diff --git a/src/swagger/specGenerator.ts b/src/swagger/specGenerator.ts
index 0297d094..941fe0c2 100644
--- a/src/swagger/specGenerator.ts
+++ b/src/swagger/specGenerator.ts
@@ -165,7 +165,6 @@ export abstract class SpecGenerator {
       any: {
         // While the any type is discouraged, it does explicitly allows anything, so it should always allow additionalProperties
         additionalProperties: true,
-        type: 'object',
       },
       binary: { type: 'string', format: 'binary' },
       boolean: { type: 'boolean' },
diff --git a/src/swagger/swagger.ts b/src/swagger/swagger.ts
index e6317649..edcb7690 100644
--- a/src/swagger/swagger.ts
+++ b/src/swagger/swagger.ts
@@ -232,7 +232,7 @@ export namespace Swagger {
   }
 
   export interface Schema extends BaseSchema {
-    type: DataType;
+    type?: DataType;
     format?: DataFormat;
     additionalProperties?: boolean | BaseSchema;
     properties?: { [propertyName: string]: Schema3 };


Test patch:
diff --git a/tests/unit/swagger/definitionsGeneration/definitions.spec.ts b/tests/unit/swagger/definitionsGeneration/definitions.spec.ts
index 69e28773..a45f235e 100644
--- a/tests/unit/swagger/definitionsGeneration/definitions.spec.ts
+++ b/tests/unit/swagger/definitionsGeneration/definitions.spec.ts
@@ -383,12 +383,12 @@ describe('Definition generation', () => {
             expect(propertySchema).to.not.haveOwnProperty('format', `for property ${propertyName}`);
           },
           anyType: (propertyName, propertySchema) => {
-            expect(propertySchema.type).to.eq('object', `for property ${propertyName}`);
+            expect(propertySchema.type).to.eq(undefined, `for property ${propertyName}`);
             expect(propertySchema['x-nullable']).to.eq(true, `for property ${propertyName}[x-nullable]`);
             expect(propertySchema.additionalProperties).to.eq(true, 'because the "unknown" type always allows more properties be definition');
           },
           unknownType: (propertyName, propertySchema) => {
-            expect(propertySchema.type).to.eq('object', `for property ${propertyName}`);
+            expect(propertySchema.type).to.eq(undefined, `for property ${propertyName}`);
             expect(propertySchema['x-nullable']).to.eq(true, `for property ${propertyName}[x-nullable]`);
             expect(propertySchema.additionalProperties).to.eq(true, 'because the "any" type always allows more properties be definition');
           },
diff --git a/tests/unit/swagger/schemaDetails3.spec.ts b/tests/unit/swagger/schemaDetails3.spec.ts
index 0d516a01..966d43db 100644
--- a/tests/unit/swagger/schemaDetails3.spec.ts
+++ b/tests/unit/swagger/schemaDetails3.spec.ts
@@ -558,12 +558,12 @@ describe('Definition generation for OpenAPI 3.0.0', () => {
             expect(propertySchema).to.not.haveOwnProperty('format', `for property ${propertyName}`);
           },
           anyType: (propertyName, propertySchema) => {
-            expect(propertySchema.type).to.eq('object', `for property ${propertyName}`);
+            expect(propertySchema.type).to.eq(undefined, `for property ${propertyName}`);
             expect(propertySchema.nullable).to.eq(true, `for property ${propertyName}.nullable`);
             expect(propertySchema.additionalProperties).to.eq(true, 'because the "any" type always allows more properties be definition');
           },
           unknownType: (propertyName, propertySchema) => {
-            expect(propertySchema.type).to.eq('object', `for property ${propertyName}`);
+            expect(propertySchema.type).to.eq(undefined, `for property ${propertyName}`);
             expect(propertySchema.nullable).to.eq(true, `for property ${propertyName}.nullable`);
             expect(propertySchema.additionalProperties).to.eq(true, 'because the "unknown" type always allows more properties be definition');
           },