acacode / acacode/swagger-typescript-api

Object additionalProperties incorrect with anyOf

Open
#469 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
4.1k
Forks
436
PR merge metrics
No merged PRs in 30d

Description

I am trying to define a schema mapping to `Record` with the following schema snippet:

```ts
type: object
additionalDetails:
type: object
description: Additional properties
additionalProperties:
anyOf:
- type: string
- type: number
- type: array
items:
type: string
```

However swagger-typescript-api seems to be ignoring `anyOf` and is just generating a signature based on the last element in the array, rather than generating a union of the listed types.

```ts
additionalDetails?: Record;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.