Open gturri opened 11 months ago
I can confirm this bug is still present in v7.5.0. However, based on a few tests it seems to only affect nullable properties of type array
.
When running openapi-generator-ci validate
on
openapi: 3.0.0
info:
title: test
version: 1.0.0
description: test
paths:
/foo:
get:
responses:
'200':
description: foo
content:
application/json:
schema:
$ref: '#/components/schemas/Entity'
components:
schemas:
Entity:
properties:
array:
type: array
nullable: true
items:
type: string
default: null
date:
type: string
format: date-time
nullable: true
default: null
type: object
the tool only complains about the default value of array
while (rightfully) considering date
as valid:
Errors:
- attribute components.schemas.Entity.default is not of type `array`
[error] Spec has 1 errors.
However, based on a few tests it seems to only affect nullable properties of type array.
I can confirm this to happen with type object
as well, but probably not scalar types.
Bug Report Checklist
Description
OpenApiGenerator CLI considers
default: null
is not correct for an attribute even if it hasnullable: true
openapi-generator version
OpenApiGenerator CLI 7.0.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
java -jar openapi-generator-cli-7.0.1.jar generate --generator-name csharp --input-spec my_spec.yaml --output out_dir
(nb: I'm writing
--generator-name csharp
because I have to pick a generator name in order to have a valid command, but I'm observing the issue with every generator)0
status code)1
status code and display the errorNote that I would expect this command to work because:
and that value (
null
) conforms the schema because it hasnullable: true
Related issues/PRs
is:issue default null
seems completely unrelatedSuggest a fix