openapi2aspida
openapi2aspida copied to clipboard
`allOf` section with `required` is not working
Description
The schema combined with required is not generated correctly.
Environment
-
Package version:
v1.10.1 -
OS:
- [ ] Linux
- [ ] Windows
- [x] macOS
-
Node.js version:
v16.14.2 -
npm version:
8.5.0
Additional context
Definition
openapi: 3.0.3
info:
title: example
version: 0.1.0
servers:
- url: https://example.com/v1
paths:
/path:
get:
summary:
responses:
'200':
description: 取得成功
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseSchema'
components:
schemas:
ResponseSchema:
allOf:
- required:
- req_property
- $ref: '#/components/schemas/BaseSchema'
BaseSchema:
type: object
properties:
req_property:
type: string
description: required property in response
unreq_property:
type: string
description: unrequired property in response
Generated
/* eslint-disable */
export type ResponseSchema = string & BaseSchema
export type BaseSchema = {
/** required property in response */
req_property?: string | undefined
/** unrequired property in response */
unreq_property?: string | undefined
}
Expected
/* eslint-disable */
export type ResponseSchema = {
/** required property in response */
req_property: string
/** unrequired property in response */
unreq_property?: string | undefined
}
export type BaseSchema = {
/** required property in response */
req_property?: string | undefined
/** unrequired property in response */
unreq_property?: string | undefined
}