diff --git a/api_deploy/processors/templates/typescript.object.jinja2 b/api_deploy/processors/templates/typescript.object.jinja2 index f31cd0f..deae8a8 100644 --- a/api_deploy/processors/templates/typescript.object.jinja2 +++ b/api_deploy/processors/templates/typescript.object.jinja2 @@ -1,3 +1,4 @@ +{%- if model.properties -%} { {%- for property in model.properties %} /** @@ -35,3 +36,6 @@ {%- endfor %} } +{%- else -%} +Record +{%- endif -%} diff --git a/tests/openapi/one_of_source.yml b/tests/openapi/one_of_source.yml index 76ce833..c10a815 100644 --- a/tests/openapi/one_of_source.yml +++ b/tests/openapi/one_of_source.yml @@ -70,6 +70,11 @@ components: - UserCreated - ProjectCreated + MessageList: + type: array + items: + type: object + additionalProperties: true UserCreated: allOf: @@ -98,6 +103,7 @@ components: type: string format: datetime + responses: CreateMessage: description: Message @@ -107,6 +113,7 @@ components: oneOf: - $ref: '#/components/schemas/UserCreated' - $ref: '#/components/schemas/ProjectCreated' + - $ref: '#/components/schemas/MessageList' x-amazon-apigateway-request-validators: all: diff --git a/tests/openapi/one_of_target.yml b/tests/openapi/one_of_target.yml index 0f44450..2aeb8e7 100644 --- a/tests/openapi/one_of_target.yml +++ b/tests/openapi/one_of_target.yml @@ -41,6 +41,7 @@ paths: oneOf: - $ref: '#/components/schemas/UserCreated' - $ref: '#/components/schemas/ProjectCreated' + - $ref: '#/components/schemas/MessageList' headers: Access-Control-Allow-Origin: schema: @@ -390,6 +391,11 @@ components: - message - parameters + MessageList: + items: + additionalProperties: true + type: object + type: array ProjectCreated: type: object additionalProperties: false