Closed
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 problem occurs with following input:
components:
schemas:
Root:
type: object
additionalProperties:
title: TestValueModel
type: object
properties:
name:
type: String
I expect number of value class to be TestValueModel
. Instead it is generated as RootValue.
This is happens because of mistype in InlineModelResolver :: gatherInlineModels at line 317:
// Check additionalProperties for inline models
if (schema.getAdditionalProperties() != null) {
if (schema.getAdditionalProperties() instanceof Schema) {
Schema inner = (Schema) schema.getAdditionalProperties();
if (inner != null) {
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
// Recurse to create $refs for inner models
gatherInlineModels(inner, schemaName);
if (isModelNeeded(inner)) {
// If this schema should be split into its own model, do so
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
schema.setAdditionalProperties(refSchema);
}
}
}
}
instead of schema.getTitle()
inner schema title inner.getTitle()
should be used.
openapi-generator version
6.6.0, but bug is still in trunk
Generation Details
spring
generator for Java