OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA] dependentSchemas properties are not included in generated model with maven generator plugin
Nobody has claimed this yet.
- 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
I'm trying to generate client for API tests from provided OpenAPI file which I get from development team. Request body consists of some parameters. One of the option parameters extends if it is send. If you send deviceId than new addition parameters from dependentSchemas will be present/mandatory. See below. Issue is when you generate model. All properties apart one from dependentSchema are present in generated class.
How can I get all parameters inside generated request body class?
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tenant": {
"type": "string",
"enum": [
"12app"
],
},
"deviceId": {
"type": "string"
},
"identityToken": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"example": [
"sport",
"premium"
],
"summary": "Article tags"
}
},
"required": [
"tenant",
"url",
"tags"
],
"dependentSchemas": {
"deviceId": {
"properties": {
"receipt": {
"type": "string"
},
"receiptSource": {
"type": "string",
"enum": [
"Apple",
"Google"
]
},
"receiptIdentifier": {
"type": "string",
"enum": [
"epaper",
"tablet",
"phone",
"universal",
"hybrid"
]
},
"packageName": {
"type": "string"
},
"productId": {
"type": "string"
},
"signature": {
"type": "string"
},
"termId": {
"type": "string"
}
},
"required": [
"receipt",
"receiptSource",
"receiptIdentifier",
"termId"
]
}
}
},
openapi-generator version
<openapi-generator-maven-plugin.version>7.6.0</openapi-generator-maven-plugin.version>
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 by reproducing the report with the provided OpenAPI schema and openapi-generator-maven-plugin version 7.6.0, then trace the Java model-generation path handling dependentSchemas. Confirm which dependent properties are omitted from the generated request-body model. Done means the generated model includes all properties from the dependent schema while preserving the existing required fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100