File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/openapi-to-graphql/src Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -581,14 +581,17 @@ function getScalarType({
581581 options . max = schema . maxLength || schema . maximum
582582 break ;
583583 case typeof schema . pattern === 'string' :
584- options . pattern = schema . pattern
584+ const qualifier = schema . pattern . match ( / \/ ( .) $ / ) || [ '' , '' ]
585+ const $pattern = schema . pattern . replace ( / ^ \/ / , '' ) . replace ( / \/ ( .) ? $ / , '' )
586+
587+ options . pattern = new RegExp ( $pattern , qualifier [ 1 ] )
585588 break ;
586589 case typeof schema . description === 'string' :
587590 options . description = schema . description . replace ( / \s / g, '' ) . trim ( )
588591 break ;
589592 case typeof schema . format === 'string' :
590593 case typeof schema . enum !== 'undefined' :
591- const format = schema . format || ''
594+ const format = schema . format || '- '
592595 const $enum = schema . enum || [ ]
593596
594597 options . sanitize = ( data ) => format . startsWith ( 'int' ) ? parseInt ( data ) : ( format === 'float' ? parseFloat ( data ) : data )
You can’t perform that action at this time.
0 commit comments