You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Using allOf or oneOf in a request body produces broken documentation. In the example below, it documents a body parameter of 'uNKNOWNBASETYPE' with a type of 'undefined'.
The following will be produced in the log:
[main] INFO o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: html2 (documentation)
[main] INFO o.o.codegen.DefaultGenerator - Generator 'html2' is considered stable.
[main] INFO o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] WARN o.o.codegen.DefaultCodegen - Empty operationId found for path: patch /pets. Renamed to auto-generated operationId: petsPatch
[main] WARN o.o.codegen.DefaultCodegen - The following schema has undefined (null) baseType. It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. A correct 'consumes' for form parameters should be 'app
lication/x-www-form-urlencoded' or 'multipart/?'
[main] WARN o.o.codegen.DefaultCodegen - schema: class ComposedSchema {
class Schema {
type: null
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
allOf: null
anyOf: null
oneOf: [class ObjectSchema {
class Schema {
type: object
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: {bark=class BooleanSchema {
class Schema {
type: boolean
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}}
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}]
}
[main] WARN o.o.codegen.DefaultCodegen - codegenModel is null. Default to UNKNOWN_BASE_TYPE
[main] INFO o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO o.o.codegen.TemplateManager - writing file /local/out/index.html
[main] INFO o.o.codegen.TemplateManager - Skipped /local/out/.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.)
[main] INFO o.o.codegen.TemplateManager - writing file /local/out/.openapi-generator/VERSION
[main] INFO o.o.codegen.TemplateManager - writing file /local/out/.openapi-generator/FILES
################################################################################
# Thanks for using OpenAPI Generator. #
# Please consider donation to help us maintain this project 🙏 #
# https://opencollective.com/openapi_generator/donate #
[main] INFO o.o.codegen.TemplateManager - writing file /local/out/.openapi-generator/VERSION
[main] INFO o.o.codegen.TemplateManager - writing file /local/out/.openapi-generator/FILES
################################################################################
# Thanks for using OpenAPI Generator. #
# Please consider donation to help us maintain this project 🙏 #
# https://opencollective.com/openapi_generator/donate #
################################################################################
openapi-generator version
5.3.0
OpenAPI declaration file content or url
This is a stripped-down version of the first oneOf example here. Using allOf instead produces the same error.
According to this issue fastapi/fastapi#684 this has been already investigated by the author of the library and it seems that the OpenAPI document is according to the spec:
It's part of the OpenAPI spec. When using $ref, the object containing it cannot contain any additional properties. So the only way to have a $ref and a description is through allOf.
Bug Report Checklist
Description
Using
allOf
oroneOf
in a request body produces broken documentation. In the example below, it documents a body parameter of 'uNKNOWNBASETYPE' with a type of 'undefined'.The following will be produced in the log:
openapi-generator version
5.3.0
OpenAPI declaration file content or url
This is a stripped-down version of the first oneOf example here. Using allOf instead produces the same error.
allOf
seems to work only if the internal type is not a reference. The following will break it:Generation Details / Steps to reproduce
test.yml
MSYS_NO_PATHCONV=1 docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.3.0 generate --input-spec "/local/test.yml" --output "/local/out" --generator-name html2
Related issues/PRs
The text was updated successfully, but these errors were encountered: