5
export class AdministratorLoginDto {
  @ApiProperty()
  userName: number[];
}

I set userName with number[], but i get the openapi is string[].

I set userName with number[], but i get the openapi json is string[].

{
  "AdministratorLoginDto": {
    "type": "object",
    "properties": {
      "userName": {
        "type": "array",
        "items": {
          "type": "string" // question: why this type is not number?
        }
      }
    },
    "required": [
      "userName"
    ]
  }
}

Thank you!

1 Answer 1

12

Try this :


export class AdministratorLoginDto {
  @ApiProperty({
     type: Number,
     isArray: true,
  })
  userName: number[];
}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.