File tree 10 files changed +25
-8
lines changed
10 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ new Benchmark.Suite()
44
44
} )
45
45
. on ( 'complete' , function ( ) {
46
46
// @ts -expect-error types are wrong
47
- console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` ) // eslint-disable-line @typescript-eslint/restrict-template-expressions
47
+ console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` )
48
48
} )
49
49
// run async
50
50
. run ( { async : true } )
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ new Benchmark.Suite()
42
42
} )
43
43
. on ( 'complete' , function ( ) {
44
44
// @ts -expect-error types are wrong
45
- console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` ) // eslint-disable-line @typescript-eslint/restrict-template-expressions
45
+ console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` )
46
46
} )
47
47
// run async
48
48
. run ( { async : true } )
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ new Benchmark.Suite()
67
67
} )
68
68
. on ( 'complete' , function ( ) {
69
69
// @ts -expect-error types are wrong
70
- console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` ) // eslint-disable-line @typescript-eslint/restrict-template-expressions
70
+ console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` )
71
71
} )
72
72
// run async
73
73
. run ( { async : true } )
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ new Benchmark.Suite()
43
43
} )
44
44
. on ( 'complete' , function ( ) {
45
45
// @ts -expect-error types are wrong
46
- console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` ) // eslint-disable-line @typescript-eslint/restrict-template-expressions
46
+ console . info ( `Fastest is ${ this . filter ( 'fastest' ) . map ( 'name' ) } ` )
47
47
} )
48
48
// run async
49
49
. run ( { async : true } )
Original file line number Diff line number Diff line change 162
162
"pbjs" : " ^0.0.14" ,
163
163
"protobufjs" : " ^7.0.0" ,
164
164
"protons-runtime" : " ^4.0.0" ,
165
- "uint8arraylist" : " ^2.3.2" ,
166
- "uint8arrays" : " ^4.0.2"
165
+ "uint8arraylist" : " ^2.3.2"
167
166
}
168
167
}
Original file line number Diff line number Diff line change @@ -595,6 +595,10 @@ function defineModule (def: ClassDef): ModuleDef {
595
595
fieldDef . repeated = fieldDef . rule === 'repeated'
596
596
fieldDef . optional = ! fieldDef . repeated && fieldDef . options ?. proto3_optional === true
597
597
fieldDef . map = fieldDef . keyType != null
598
+
599
+ if ( fieldDef . rule === 'required' ) {
600
+ throw new Error ( '"required" fields are not allowed in proto3 - please convert your proto2 definitions to proto3' )
601
+ }
598
602
}
599
603
}
600
604
Original file line number Diff line number Diff line change
1
+ syntax = "proto2" ;
2
+
3
+ message Message {
4
+ required string requiredField = 1 ;
5
+ }
Original file line number Diff line number Diff line change 1
1
/* eslint-env mocha */
2
- /* eslint-disable @typescript-eslint/restrict-template-expressions */
3
2
4
3
import { expect } from 'aegir/chai'
5
4
import pbjs from 'pbjs'
Original file line number Diff line number Diff line change 1
1
/* eslint-env mocha */
2
- /* eslint-disable @typescript-eslint/restrict-template-expressions */
3
2
4
3
import { expect } from 'aegir/chai'
5
4
import { MapTypes , SubMessage } from './fixtures/maps.js'
Original file line number Diff line number Diff line change
1
+ /* eslint-env mocha */
2
+
3
+ import { expect } from 'aegir/chai'
4
+ import { generate } from '../src/index.js'
5
+
6
+ describe ( 'unsupported' , ( ) => {
7
+ it ( 'should refuse to generate source from proto2 definition' , async ( ) => {
8
+ await expect ( generate ( 'test/fixtures/proto2.proto' , { } ) ) . to . eventually . be . rejected
9
+ . with . property ( 'message' ) . that . contain ( '"required" fields are not allowed in proto3' )
10
+ } )
11
+ } )
You can’t perform that action at this time.
0 commit comments