Skip to content

Instantly share code, notes, and snippets.

@DavidBiesack
Last active November 12, 2020 18:31
Show Gist options
  • Save DavidBiesack/6ee2c3ff7eaa42bf72aa77318c07e659 to your computer and use it in GitHub Desktop.
Save DavidBiesack/6ee2c3ff7eaa42bf72aa77318c07e659 to your computer and use it in GitHub Desktop.
Show that openapi-generator does not honor required properties for typescript-axios; see https://github.com/OpenAPITools/openapi-generator/issues/7930
openapi: 3.0.2
info:
title: allOf and requried fields
description: >-
demonstrate issues with openapi-generator for typescript-axios for
schema composition with `allOf` and `required` fields
version: 0.0.1
contact:
name: Apiture
url: 'https://developer.apiture.com'
servers:
- url: 'https://example.com.com/issue'
tags:
- name: example
description: example
paths:
/things:
get:
description: Get things.
operationId: getThings
tags:
- example
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/things'
components:
schemas:
things:
description: Things
type: object
required:
- thing
- thatThing
- otherThing
allOf:
- $ref: '#/components/schemas/base'
- type: object
properties:
thing:
$ref: '#/components/schemas/thing1'
thatThing:
$ref: '#/components/schemas/thing3'
otherThing:
description: other thing
readOnly: true
allOf:
- $ref: '#/components/schemas/thing2'
thing1:
description: Thing1
allOf:
- $ref: '#/components/schemas/base'
thing2:
description: Thing2
required:
- a
- b
allOf:
- $ref: '#/components/schemas/base'
thing3:
description: Thing3
required:
- a
- b
allOf:
- $ref: '#/components/schemas/thing1'
msgs:
description: messages object, a map of string -> msg
type: object
additionalProperties:
$ref: "#/components/schemas/msg"
msg:
description: msg
type: object
required:
- message
- id
properties:
message:
type: string
id:
type: string
base:
description: Base type.
type: object
properties:
a:
description: A
type: string
b:
description: B
type: string
format: uri
msgs1:
description: map of string -> msg
additionalProperties:
$ref: "#/components/schemas/msg"
msgs2:
$ref: "#/components/schemas/msgs"
example:
a: "aaa"
b: "http://www.example.com"
msgs1:
foo:
message: bar
id: "123x"
fu:
message: barr
id: "x123"
msgs2:
foo_:
message: bar_
id: "123x_"
fu_:
message: barr_
id: "x123_"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment