influxdata / influxdata/oats

Oats can't handle complex types as query parameters

Open
#18 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14
Forks
5
Avg merge
3d 8h
Merged PRs (30d)
1

Description

If using something as simple as an array, oats' generated code results in `any`.

For example, the following swagger generates this interface:
```ts
export interface GetStuffParams {
query?: {
stuffFilter?: string
stuffFilterComplex?: any
}
}
```

```yaml
openapi: "3.0.0"
info:
title: Stuff service
version: 0.0.0
servers:
- url: /api/v2
paths:
/stuff:
get:
operationId: createStuff
parameters:
- $ref: "#/components/parameters/StuffFilter"
- $ref: "#/components/parameters/StuffFilterComplex"
responses:
'204':
$ref: "#/components/responses/NoContent"
components:
parameters:
StuffFilter:
in: query
name: stuffFilter
required: false
description: stuff to return
schema:
type: string
StuffFilterComplex:
in: query
name: stuffFilterComplex
required: false
description: stuff to return
schema:
type: array
items:
type: string
responses:
NoContent:
description: No content
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the OpenAPI document in the issue and inspect the generated GetStuffParams interface, focusing on the array query parameter that becomes any. Trace the generator entry point that maps the parameter schema to TypeScript, then add or update coverage for this example. Done means the generated type represents an array of strings rather than any.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.