forked from loafle/openapi-generator-original
[dart-dio] Correctly serialize path parameters (#14666)
This commit is contained in:
parent
8c1f4b1a62
commit
bca80c0d3d
@ -674,7 +674,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library) && (op.getHasFormParams() || op.getHasQueryParams())) {
|
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library) && (op.getHasFormParams() || op.getHasQueryParams() || op.getHasPathParams())) {
|
||||||
resultImports.add("package:" + pubName + "/" + sourceFolder + "/api_util.dart");
|
resultImports.add("package:" + pubName + "/" + sourceFolder + "/api_util.dart");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class {{classname}} {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}};
|
final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}.toString()){{/pathParams}};
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}',
|
method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}',
|
||||||
{{#isResponseFile}}
|
{{#isResponseFile}}
|
||||||
|
@ -117,7 +117,7 @@ class PetApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
|
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'DELETE',
|
method: r'DELETE',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -341,7 +341,7 @@ class PetApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
|
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'GET',
|
method: r'GET',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -499,7 +499,7 @@ class PetApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
|
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'POST',
|
method: r'POST',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -577,7 +577,7 @@ class PetApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString());
|
final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'POST',
|
method: r'POST',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -683,7 +683,7 @@ class PetApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString());
|
final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'POST',
|
method: r'POST',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
|
@ -8,6 +8,7 @@ import 'package:built_value/serializer.dart';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:openapi/src/api_util.dart';
|
||||||
import 'package:openapi/src/model/order.dart';
|
import 'package:openapi/src/model/order.dart';
|
||||||
|
|
||||||
class StoreApi {
|
class StoreApi {
|
||||||
@ -41,7 +42,7 @@ class StoreApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
|
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', encodeQueryParameter(_serializers, orderId, const FullType(String)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'DELETE',
|
method: r'DELETE',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -168,7 +169,7 @@ class StoreApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
|
final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', encodeQueryParameter(_serializers, orderId, const FullType(int)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'GET',
|
method: r'GET',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
|
@ -243,7 +243,7 @@ class UserApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
|
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'DELETE',
|
method: r'DELETE',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -290,7 +290,7 @@ class UserApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
|
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'GET',
|
method: r'GET',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
@ -492,7 +492,7 @@ class UserApi {
|
|||||||
ProgressCallback? onSendProgress,
|
ProgressCallback? onSendProgress,
|
||||||
ProgressCallback? onReceiveProgress,
|
ProgressCallback? onReceiveProgress,
|
||||||
}) async {
|
}) async {
|
||||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
|
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||||
final _options = Options(
|
final _options = Options(
|
||||||
method: r'PUT',
|
method: r'PUT',
|
||||||
headers: <String, dynamic>{
|
headers: <String, dynamic>{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user