We have been using OpenAPI 3.0.x specification, which adds feature for declaring nullable
properties.
When I import this OpenAPI into AWS API Gateway, corresponding model does not honor this nullable setting.
Is there any way how to declare nullable
property in OpenAPI 3.0.x so AWS API gateway recognises and configures underlying model with this setting as well?
Example OpenAPI specification
openapi: "3.0.2"
info:
title: Test
description: |
API
version: "0.1.0"
license:
name: Private
url: https://fillme.one/license
servers:
- url: /api/v1
paths:
/accounts:
post:
operationId: repa
responses:
200:
description: test
requestBody:
content:
application/json:
schema:
type: object
properties:
date:
type: string
format: date-time
nullable: true
required:
- date
Resulting JSON schema document for generated model
{
"required" : [ "date" ],
"type" : "object",
"properties" : {
"date" : {
"type" : "string",
"format" : "date-time"
}
}
}
Clearly, type should be union of ["string", null]
but AWS API Gateway ignores OpenAPI specification.
Any help?
"type": ["string", "null"]
in your openapi document. Otherwise, this is probably a bug that should be filed with your implementation. – Libbnullable
property. The JSON schema is generated by AWS API GW from OpenAPI so I would have to post-process it manually, which is undesired – Pinochle