chopper icon indicating copy to clipboard operation
chopper copied to clipboard

'with' can't be used as an identifier because it's a keyword.

Open Vovanella95 opened this issue 3 years ago • 6 comments

Hi there, I have next request. One of my parameters named $with. $with is allowed name by CodeBuilder and DartFormatter classes. Anyway I received error. Possible problem in chopper_generator.

@Get(path: '/v1/customer/{customerId}') Future<chopper.Response> v1CustomerCustomerIdGet({ @Header() required String? xCus, @Path('customerId') required String? customerId, @Query() required String? $with, });

Next error is appeared:

Could not format because the source could not be parsed: line 8, column 37 of .: 'with' can't be used as an identifier because it's a keyword. 8 │ final $params = <String, dynamic>{'$with': $with};

In 4.0.0-nullsafety.0 everything was OK

Vovanella95 avatar Jun 04 '21 14:06 Vovanella95

Interesting remark: if fieldname = 'a$with' it failed too.

Vovanella95 avatar Jun 04 '21 14:06 Vovanella95

Can someone take a look at it? We mostly need it for codegen based on swagger files. $with should be the completely OK name.

fryette avatar Jun 06 '21 10:06 fryette

I haven't looked yet, but probably related to https://github.com/lejard-h/chopper/issues/258?

JEuler avatar Jun 07 '21 01:06 JEuler

I have released the new version. Could you please check if it helped? :)

JEuler avatar Nov 07 '21 10:11 JEuler

Hi @JEuler , Sorry did not checked it yet. Will take a look during weak or two

Vovanella95 avatar Nov 08 '21 07:11 Vovanella95

I have checked - not working yet(

JEuler avatar Nov 15 '21 18:11 JEuler

@JEuler @Vovanella95 is this still an issue?

techouse avatar Mar 12 '23 21:03 techouse

Personally, I don't think so. But it is presents still. :)

JEuler avatar Mar 13 '23 00:03 JEuler