File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -3,35 +3,31 @@ import type { OpenAPIV3_1 } from 'openapi-types';
33import { MediaType , type MediaTypeOptions } from './media-type.js' ;
44
55export interface RequestBodyOptions {
6- content ? : MediaType | MediaTypeOptions ;
6+ content : MediaType | MediaTypeOptions ;
77 description ?: string ;
88 required ?: boolean ;
99}
1010
1111export class RequestBody extends Construct {
1212 private options : RequestBodyOptions ;
1313
14- private content : MediaType | undefined ;
14+ private content : MediaType ;
1515
1616 constructor ( scope : Construct , id : string , options : RequestBodyOptions ) {
1717 super ( scope , id ) ;
1818 this . options = options ;
1919
20- if ( options . content ) {
21- this . content =
22- options . content instanceof MediaType
23- ? options . content
24- : new MediaType ( this , id , options . content ) ;
25- }
20+ this . content =
21+ options . content instanceof MediaType
22+ ? options . content
23+ : new MediaType ( this , id , options . content ) ;
2624 }
2725
2826 public synth ( ) : OpenAPIV3_1 . RequestBodyObject {
2927 return {
3028 description : this . options . description || '' ,
3129 content : {
32- ...( this . content && {
33- [ this . content . contentType ] : this . content . synth ( ) ,
34- } ) ,
30+ [ this . options . content . contentType ] : this . content . synth ( ) ,
3531 } ,
3632 ...( this . options . required && { required : this . options . required } ) ,
3733 } ;
You can’t perform that action at this time.
0 commit comments