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

Self referencing `datetime` #193

Closed dickermoshe closed 4 months ago

dickermoshe commented 4 months ago
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, unused_import

typedef DateTime = DateTime?;
/// Typedefs can't reference themselves directly or recursively via another typedef.dart[type_alias_cannot_reference_itself](https://dart.dev/diagnostics/type_alias_cannot_reference_itself)

Schema

openapi: 3.0.0
info:
  title: Foo
  version: 1.0.0
paths:
  /foo:
    get:
      responses:
        '200':
          description: example
          content:
            application/json:
              schema:
                type: array
                items:
                 $ref: '#/components/schemas/Payment'
components:
  schemas:
    DateTime:
      type: string
      format: date-time
      example: "2019-01-01T00:00:00"
    # the following schema shouldn't be generated as model
    AllOfDatetime:
      allOf:
        - $ref: '#/components/schemas/DateTime'
      example: "2019-01-01 00:00:00" 
    Payment:
      type: object
      properties:
        date:
          $ref: '#/components/schemas/AllOfDatetime'
        amount:
          type: number
          format: float
          example: 625.0
dickermoshe commented 4 months ago

This is caused by the same problem with nameclashes with retrofit or dio. Closing as duplicate