Carapacik / swagger_parser

Dart package that takes an OpenApi definition file and generates REST clients based on retrofit and data classes for your project.
https://pub.dev/packages/swagger_parser
MIT License
88 stars 33 forks source link

Duplicate keywords on APIClient #189

Closed dickermoshe closed 4 months ago

dickermoshe commented 4 months ago

Retrofit has no way to handle duplicate params where one is header and the other is a query param

// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, unused_import

import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:retrofit/retrofit.dart';

part 'client_client.g.dart';

@RestApi()
abstract class ClientClient {
  factory ClientClient(Dio dio, {String? baseUrl}) = _ClientClient;

  @MultiPart()
  @POST('/pet/{id}')
  Future<void> create({
    @Path('id') required int id,
    @Header('id') required int id,
    @Query('id') required int id,
    @Part(name: 'id') int? id,
    @Part(name: 'pathid') int? pathid,
    @Part(name: 'headerId2') int? headerId2,
    @Part(name: 'cookieId2') int? cookieId2,
    @Part(name: 'queryId2') int? queryId2,
  });
}

Schema


openapi: 3.0.0
info:
  version: 1.0.0
  title: OpenAPI Petstore
paths:
  /pet/{id}:
    post:
      operationId: create
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
            format: int32
        - in: header
          name: id
          schema:
            type: integer
            format: int32
        - in: cookie
          name: id
          schema:
            type: integer
            format: int32
        - in: query
          name: id
          schema:
            type: integer
            format: int32
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  format: int32
                pathid:
                  type: integer
                  format: int32
                headerId2:
                  type: integer
                  format: int32
                cookieId2:
                  type: integer
                  format: int32
                queryId2:
                  type: integer
                  format: int32
      responses:
        '400':
          description: Invalid pet value