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

Unable to compile code generated when a query parameter is present and the response constitutes an array of objects #68

Closed
tablet0ps opened this issue Mar 17, 2024 · 1 comment
Assignees

Comments

@tablet0ps
Copy link

tablet0ps commented Mar 17, 2024

I am trying to generate client-side code using openapi_spec CLI. In such condition I am unable to compile the generated code. Here's the spec:

{
  "openapi": "3.0.1",
  "info": {
    "title": "Test Doc",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://localhost:3000",
      "description": "Test Server"
    }
  ],
  "paths": {
    "/notes": {
      "get": {
        "operationId": "getNotes",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Note"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Note": {
        "required": [
          "noteId"
        ],
        "type": "object",
        "properties": {
          "noteId": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    }
  }
}

Error received:

ERROR: ../test_sdk/lib/src/client.dart:384:29: Error: Member not found: 'List.fromJson'.
ERROR:     return GetNotesResponse.fromJson(_jsonDecode(r));
ERROR:                             ^^^^^^^^
ERROR: Target kernel_snapshot failed: Exception
@walsha2
Copy link
Contributor

walsha2 commented Mar 17, 2024

@tablet0ps thanks for the issue, will take a look and report back.

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

No branches or pull requests

2 participants