OpenAPITools / OpenAPITools/openapi-generator
[BUG][PYTHON] ComposedSchema - Type null not handled properly in toExampleValue
Open
Nobody has claimed this yet.
Client: Python
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
PythonClientCodegen when run against openapi.yaml will produce the followin warning output.
[main] WARN o.o.c.l.AbstractPythonCodegen - Type null not handled properly in toExampleValue
openapi-generator version
5.2.1
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: API
version: 1.0.0
paths:
/pet:
get:
operationId: get_handler
parameters:
- in: query
name: pet
schema:
$ref: '#/components/schemas/Dog'
responses:
'200':
content:
application/json:
schema:
type: object
description: Success
components:
schemas:
Pet:
type: object
properties:
pet_type:
type: string
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
bark:
type: boolean
Generation Details
openapi-generator generate -i openapi.yaml -g python-flask -t templates --package-name
Steps to reproduce
Generate the client using the command above
Related issues/PRs
No similar PR
Suggest a fix
Handle the ComposedSchema example generation in AbstractPythonCodegen -> toExampleValueRecursive.
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 in AbstractPythonCodegen.toExampleValueRecursive, using the provided openapi.yaml and the Python Flask generation command to reproduce the warning. The work is complete when the ComposedSchema example generation handles the null type without emitting the reported warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100