OpenAPITools / OpenAPITools/openapi-generator
[BUG] not nullable property is shown as nullable
Open
Nobody has claimed this yet.
Client: Rust
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The minimal declaration file pasted below results in the Bar.notNullable property getting isNullable: "true" set.
openapi-generator version
Current master (40018c333d55f311620398b6a73c903187b8da75)
It's a regresssion.
OpenAPI declaration file content or url
---
openapi: 3.0.3
info:
title: Foo
version: v1
servers:
- url: /
description: Foo
paths:
/foo:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Bar'
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Bar'
components:
schemas:
Bar:
required:
- foo
type: object
properties:
notNullable:
allOf:
- $ref: '#/components/schemas/EnumFoo'
nullable: false
EnumFoo:
enum:
- FOO
- BAR
type: string
Generation Details
Steps to reproduce
openapi-generator-cli generate -g rust -o out -i openapi.yml --global-property debugModels=true
Cheers!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal OpenAPI YAML and reproduce the result using the Rust generation command with debugModels enabled. Inspect the generated model metadata for Bar.notNullable; the work is done when the required property with nullable: false is no longer reported as nullable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, rust
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100