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

Use List instead of Array #16

Open
ashwini-desai opened this issue Jul 23, 2020 · 0 comments
Open

Use List instead of Array #16

ashwini-desai opened this issue Jul 23, 2020 · 0 comments
Labels

Comments

@ashwini-desai
Copy link
Collaborator

ashwini-desai commented Jul 23, 2020

Problem:

The class generated for Request and Response models with type array should use List instead of Array

paths:
  /pets:
    get:
      responses:
        '200':
        description: pet response
        application/json:
          schema:
          type: array
          items:
            $ref: '#/components/schemas/Pet'

components:
  schemas:
    Pet:
      type: object
      required:
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string

For example, the above responses block and Pet schema would generate

override fun findPets(tags: Array<String>?, limit: Int?): Array<Pet> {
  return tags?.let { tagList -> petStore.filter { pet -> tagList.contains(pet.tag) } }?.toTypedArray() ?: arrayOf()
}

We should update codegen to use List<*> as the return type instead

@ashwini-desai ashwini-desai mentioned this issue Sep 18, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants