Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DartError: TypeError: null: type 'Null' is not a subtype of type 'Map<String, dynamic>' #280

Closed
gonft opened this issue Dec 4, 2024 · 0 comments · Fixed by #281
Closed

Comments

@gonft
Copy link
Contributor

gonft commented Dec 4, 2024

Steps to reproduce

  1. Launch the web interface (https://carapacik.github.io/swagger_parser)
  2. Tap Generate and download

Expected results

Generate code

Actual results

Failed to generate files.
    type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast
    #0      OpenApiParser.parseRestClients.parametersV3 (package:swagger_parser/src/parser/parser/open_api_parser.dart:365:49)
    #1      OpenApiParser.parseRestClients.<anonymous closure>.<anonymous closure> (package:swagger_parser/src/parser/parser/open_api_parser.dart:583:15)
    #2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
    #3      OpenApiParser.parseRestClients.<anonymous closure> (package:swagger_parser/src/parser/parser/open_api_parser.dart:567:17)
    #4      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
    #5      OpenApiParser.parseRestClients (package:swagger_parser/src/parser/parser/open_api_parser.dart:554:10)
    #6      GenProcessor.generateFiles (package:swagger_parser/src/generator/generator/generator_processor.dart:32:32)
    <asynchronous suspension>
    #7      main (file:///Users/paul/.pub-cache/hosted/pub.dev/swagger_parser-1.19.2/bin/swagger_parser.dart:22:39)
    <asynchronous suspension>

Your OpenApi snippet

openapi: 3.0.3
info:
  title: API Document
  description: Swagger UI를 이용한 API 문서입니다.
  license:
    name: MIT License
  version: 1.0.0
servers:
- url: /
paths:
  /api/v1/members/agreements/agree:
    post:
      tags:
      - 온보딩
      summary: 약관 동의
      description: "\n            약관 동의\n            "
      operationId: api_v1_members_agreements_agree_create
      parameters:
      - name: Authorization
        in: header
        description: "Bearer {token} 형태로 값을 넣습니다. Swagger에서 테스트 하기 위해서는 상단에 Authorize\
          \ 버튼을 이용합니다."
        required: true
        style: simple
        explode: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MemberAgreement'
          application/x-www-form-urlencoded:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MemberAgreement'
          multipart/form-data:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MemberAgreement'
        required: true
      responses:
        "200":
          description: Simple response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
              examples:
                Success:
                  value:
                    status: Success
                    message: 요청이 성공했습니다.
      security:
      - tokenAuth: []
      - {}
components:
  schemas:
    MemberAgreement:
      required:
      - agreement_id
      type: object
      properties:
        agreement_id:
          maximum: 9223372036854775807
          minimum: -9223372036854775808
          type: integer
          format: int64
        agreed:
          type: boolean
    SimpleResponse:
      required:
      - message
      - status
      type: object
      properties:
        status:
          type: string
        message:
          type: string
  securitySchemes:
    tokenAuth:
      type: apiKey
      description: Token-based authentication with required prefix "Token"
      name: Authorization
      in: header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant