Skip to content

arrays of objects as query parameters cause a crush #619

@orensolo

Description

@orensolo

Hi,

Query parameters that are defined as arrays of objects (i.e not primitives) causing kin-openapi to crush with panic (schema has non primitive type ...)

This also the case when the items in the query paramaters array are defined with polymorphism like anyof, allof etc.

It seems that kin-openapi assumes that all query parameters arrays must contain only primitives.
But this is a valid schema.

For example :

Consider the schema:

 paths:
  /nf-instances:
   get:
   - description: Names of the services offered by the NF
        explode: false
        in: query
        name: service-names
        required: false
        schema:
          items:
            $ref: '#/components/schemas/ServiceName'
          minItems: 1
          type: array
          uniqueItems: true
    ...
       ServiceName:
      anyOf:
      - $ref: '#/components/schemas/ServiceName_anyOf'
      - type: string
      description: Service names known to NRF

And consider the following request:

nf-instances?service-names=npcf-am-policy-control

This request causes a panic. because the service-names items type is not a primitive.

Thanks,
Oren

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions