File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ module.exports = {
24
24
responses : {
25
25
"200" : {
26
26
description : "JSON object with hex property" ,
27
- schema : bodySchema . openapi ( )
27
+ schema : bodySchema . openAPI ( )
28
28
}
29
29
}
30
30
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ module.exports = {
21
21
responses : {
22
22
"200" : {
23
23
description : "JSON object with uppercase property names" ,
24
- schema : bodySchema . openapi ( )
24
+ schema : bodySchema . openAPI ( )
25
25
}
26
26
}
27
27
}
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ const schemas = require ( "./schemas" ) ;
3
+ const tap = require ( "tap" ) ;
4
+
5
+ tap . test ( "schemas.define supports example data" , test => {
6
+ const ssn = schemas . define ( {
7
+ type : "string" ,
8
+ pattern : / ^ \d { 3 } - \d { 2 } - \d { 4 } $ / . source ,
9
+ example : "111-22-3333"
10
+ } ) ;
11
+ test . same ( ssn . openAPI ( ) . example , "111-22-3333" ) ;
12
+ test . end ( ) ;
13
+ } ) ;
14
+
15
+ tap . test ( "schemas.define supports example function" , test => {
16
+ const ssn = schemas . define ( {
17
+ type : "string" ,
18
+ pattern : / ^ \d { 3 } - \d { 2 } - \d { 4 } $ / . source ,
19
+ example : ( ) => "111-22-3333"
20
+ } ) ;
21
+ test . same ( ssn . openAPI ( ) . example , "111-22-3333" ) ;
22
+ test . end ( ) ;
23
+ } ) ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function define(jsonSchema) {
22
22
}
23
23
return null ;
24
24
} ,
25
- openapi ( ) {
25
+ openAPI ( ) {
26
26
const api = Object . assign ( { } , jsonSchema ) ;
27
27
if ( typeof jsonSchema . example === "function" ) {
28
28
api . example = jsonSchema . example ( ) ;
You can’t perform that action at this time.
0 commit comments