Skip to content

Commit 5542777

Browse files
committed
Fix tests and call signatures
1 parent dbd56fb commit 5542777

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

src/DefinitionGenerator.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
11
import { dereference } from '@jdw/jst';
2-
import * as c from 'chalk';
32
import * as openApiValidator from 'swagger2openapi/validate';
43

54
import * as uuid from 'uuid';
6-
import { IDefinitionConfig, ILog, IParameterConfig, IServerlessFunctionConfig } from './types';
5+
import { IDefinition, IDefinitionConfig, IParameterConfig, IServerlessFunctionConfig } from './types';
76
import { clone, merge } from './utils';
87

98
export class DefinitionGenerator {
109
// The OpenAPI version we currently validate against
1110
public version = '3.0.0-RC1';
1211

1312
// Base configuration object
14-
public definition = {
13+
public definition = <IDefinition> {
1514
openapi: this.version,
16-
description: '',
17-
version: '0.0.0',
18-
title: '',
19-
paths: {},
20-
components: {
21-
schemas: {},
22-
},
15+
components: {},
2316
};
2417

25-
private config: IDefinitionConfig;
26-
private log: ILog;
18+
public config: IDefinitionConfig;
2719

2820
/**
2921
* Constructor
3022
* @param serviceDescriptor IServiceDescription
3123
*/
32-
constructor ({ log, config }: {
33-
log: ILog,
34-
config: IDefinitionConfig,
35-
}) {
24+
constructor (config: IDefinitionConfig) {
3625
this.config = clone(config);
37-
this.log = log;
3826
}
3927

4028
public parse () {
@@ -47,7 +35,6 @@ export class DefinitionGenerator {
4735

4836
merge(this.definition, {
4937
openapi: this.version,
50-
servers: [],
5138
info: { title, description, version },
5239
paths: {},
5340
components: {

src/ServerlessOpenApiDocumentation.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ export class ServerlessOpenApiDocumentation {
104104
private generate () {
105105
this.log(c.bold.underline('OpenAPI v3 Documentation Generator\n\n'));
106106
// Instantiate DocumentGenerator
107-
const generator = new DefinitionGenerator({
108-
config: this.customVars.documentation,
109-
log: this.log,
110-
});
107+
const generator = new DefinitionGenerator(this.customVars.documentation);
111108

112109
generator.parse();
113110

src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,12 @@ export interface IParameterConfig {
4444
examples?: [any];
4545
}
4646

47+
// FIXME:
48+
export interface IDefinition {
49+
openapi: string;
50+
components: any;
51+
info: any;
52+
paths: any;
53+
}
54+
4755
export type ILog = (...str: string[]) => void;

0 commit comments

Comments
 (0)