How to define array query parameter in Open 3.0.3?

Viewed 88

I am using openapi 3.0.3 with sbt. I need to add an optional array query parameter in on endpoint. GroupBy parameter is not necessary, there could be minimum 0 or max 2 values. Here's what I have done -

parameters:
        - name: groupBy
          in: query
          description: Group by
          required: false
          schema:
            type: array
            items:
              type: string

When I use sbt openApiGenerate the following method signature is generated -

def getStats(repoHrn: String, groupBy: String)
      (implicit toEntityMarshallerBadRequestDetails: ToEntityMarshaller[BadRequestDetails], toEntityMarshallerIdStat: ToEntityMarshaller[IdStat]): Route

I need it to be generated as -

def getStats(repoHrn: String, groupBy: Option[Array[String]])
      (implicit toEntityMarshallerBadRequestDetails: ToEntityMarshaller[BadRequestDetails], toEntityMarshallerIdStat: ToEntityMarshaller[IdStat]): Route

I tried several things, nothing seems to work. I read the doc but I don't know what is something I am missing here.

0 Answers
Related