Bug Report Checklist
Description
It looks like #8040 broke the ruby client generator when required properties point to a oneOf schema.
openapi-generator version
master @ acedd1c
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: oneOf repro
version: v1
paths:
'/hello':
post:
operationId: hello.post
requestBody:
content:
application/json:
schema:
type: object
required: [greeting]
properties:
greeting:
$ref: '#/components/schemas/Greeting'
responses:
'204':
description: returns a greeting
components:
schemas:
Greeting:
oneOf:
- type: string
- type: object
Generation Details
openapi-generator generate -i oneof_broken.yaml -g ruby --library faraday -o out/ruby_oneof
Steps to reproduce
- run the command above by passing the openapi file yet above
- generation fails with
Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Default'
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:675)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:878)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:440)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.NullPointerException
at org.openapitools.codegen.languages.RubyClientCodegen.constructExampleCode(RubyClientCodegen.java:736)
at org.openapitools.codegen.languages.RubyClientCodegen.constructExampleCode(RubyClientCodegen.java:751)
at org.openapitools.codegen.languages.RubyClientCodegen.constructExampleCode(RubyClientCodegen.java:726)
at org.openapitools.codegen.languages.RubyClientCodegen.constructExampleCode(RubyClientCodegen.java:759)
at org.openapitools.codegen.languages.RubyClientCodegen.constructExampleCode(RubyClientCodegen.java:664)
at org.openapitools.codegen.languages.RubyClientCodegen.postProcessOperationsWithModels(RubyClientCodegen.java:588)
at org.openapitools.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:1194)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:580)
- comment out the
required: [greeting] line
- generation works
Related issues/PRs
#8040
Suggest a fix
unsure, sorry.
@zippolyte @jirikuncar @wing328
Bug Report Checklist
Description
It looks like #8040 broke the ruby client generator when required properties point to a oneOf schema.
openapi-generator version
master @ acedd1c
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
required: [greeting]lineRelated issues/PRs
#8040
Suggest a fix
unsure, sorry.
@zippolyte @jirikuncar @wing328