File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed
packages/serverless-openapi/src Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
import Serverless from 'serverless' ;
2
2
import { CustomProperties , customProperties } from './lib/custom.properties' ;
3
3
import { writeFileSync } from 'fs' ;
4
- import { functioneventProperties } from './lib/functionEvent.properties' ;
4
+ import { functionEventProperties } from './lib/functionEvent.properties' ;
5
5
import { dump } from 'js-yaml' ;
6
6
import { CommandsDefinition } from './lib/comand.types' ;
7
7
import { Generator } from './lib/generator' ;
@@ -49,7 +49,7 @@ export class ServerlessPlugin {
49
49
serverless . configSchemaHandler . defineFunctionEventProperties (
50
50
'aws' ,
51
51
'http' ,
52
- functioneventProperties
52
+ functionEventProperties
53
53
) ;
54
54
55
55
this . hooks = {
Original file line number Diff line number Diff line change 1
1
import { JSONSchema7 } from 'json-schema' ;
2
2
3
- export const functioneventProperties = {
3
+ export const functionEventProperties = {
4
4
properties : {
5
5
tags : {
6
6
type : 'array' ,
Original file line number Diff line number Diff line change @@ -202,17 +202,18 @@ export class Generator {
202
202
203
203
const schemaJSON = requestSchemas [ 'application/json' ] ;
204
204
request . description = schemaJSON . description ;
205
+ const name = schemaJSON . customName ?? schemaJSON . name ;
205
206
206
207
if ( schemaJSON . schema ) {
207
208
request [ 'content' ] = {
208
209
'application/json' : {
209
210
schema : {
210
- $ref : '#/components/schemas/' + schemaJSON . name ,
211
+ $ref : '#/components/schemas/' + name ,
211
212
} ,
212
213
} ,
213
214
} ;
214
215
delete schemaJSON . schema [ '$schema' ] ;
215
- openApi . components . schemas [ schemaJSON . name ] = schemaJSON . schema as any ;
216
+ openApi . components . schemas [ name ] = schemaJSON . schema as any ;
216
217
}
217
218
return request ;
218
219
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { JSONSchema7 } from 'json-schema';
2
2
3
3
export interface Schema {
4
4
schema ?: JSONSchema7 ;
5
- name : string ;
5
+ customName ?: string ;
6
+ name ?: string ;
6
7
description ?: string ;
7
8
}
You can’t perform that action at this time.
0 commit comments