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

Converting object to an encodable object failed: Instance of 'NoSuchMethodError' #759

Open
HEBOS opened this issue Jun 25, 2024 · 0 comments
Assignees
Labels
bug Something isn't working Triage needed

Comments

@HEBOS
Copy link

HEBOS commented Jun 25, 2024

Describe the bug
Getting Converting object to an encodable object failed: Instance of 'NoSuchMethodError', when I try performing API request.
I can see similar issue closed long time ago: #335 , but it is still happening to me.

To Reproduce
swagger.json

final blobFile = BlobFile(
          documentType: DocumentType.cashdocument,
          date: DateTime.now(),
          description: null,
          name: 'test',
          blobFormatType: BlobFormatType.pdf,
          blobFileType: BlobFileType.document,
          blobFileId: 'test',
          lastChange: (
            userId: 'test',
            date: DateTime.now(),
          ),
          owner: UserOwned(
            userId: 'test',
            name: 'test',
          ).toJson(),
          team: TeamOwned(
            teamId: 'test',
            name: 'test',
          ),
        );

final uploadResult = await _treemlyClientService.client.apiBlobFilesPost(
          body: blobFile,
        );

Settings used for generating client:

targets:
  $default:
    sources:
      - lib/**
      - swagger/**
      - $package$
    builders:
      chopper_generator:
        options:
          header: "//Generated code"
      swagger_dart_code_generator|swagger_dart_code_generator:
        options:
          input_folder: 'swagger/'
          output_folder: 'lib/api'
          with_converter: true
          ignore_headers: true
          additional_headers:
            - "Cache-Control"
          separate_models: true
          usePathForRequestNames: false
          enums_case_sensitive: true
          use_required_attribute_for_headers: true
          include_if_null: false
          default_values_map:
            - type_name: int
              default_value: '0'
            - type_name: String
              default_value: 'default'
            - type_name: 'List<String>'
              default_value: '[]'

Expected behavior
Expected is for API request to be executed.

Swagger specification link
Attached, so no link needed.

Library version used:
2.15.2

Additional context
n/a

@HEBOS HEBOS added bug Something isn't working Triage needed labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

No branches or pull requests

3 participants