swagger_parser icon indicating copy to clipboard operation
swagger_parser copied to clipboard

Query parameters with $ in them are not escaped

Open JamesHancockAtteria opened this issue 5 months ago • 0 comments

Steps to reproduce

Use this: openapi.json

This has $filter etc for odata functionality on it.

It causes errors in the generated code for @Query('$filter') because it thinks it should be passing a variable.

Expected results

Should recognize the $filter etc. names and escape the $ ($)

Actual results

Doesn't escape so dart thinks it's a variable insertion into a string.

Your OpenApi snippet

See above.

Code sample

Code sample
  /// List Users.
  ///
  /// [filter] - Filter the results using OData syntax.
  ///
  /// [orderby] - Order the results using OData syntax.
  ///
  /// [top] - Limit the number of results.
  ///
  /// [skip] - Skip the specified number of results.
  ///
  /// [count] - Return the Total Count before pagination.
  @GET('/v1/Users/list')
  Future<IQueryResultIAsyncEnumerableOfPersonRefDto> list({
    @Query('$filter') String? object0,
    @Query('$orderby') String? object1,
    @Query('$top') int? object2,
    @Query('$skip') int? object3,
    @Query('$count') bool? object4,
  });

Logs

Logs
[Paste your logs here]

Dart version and used packages versions

Dart version
[Paste your output here]
Packages version
[Paste your output here]

JamesHancockAtteria avatar Sep 26 '24 19:09 JamesHancockAtteria