OpenAPITools / OpenAPITools/openapi-generator
[KOTLIN-SPRING] Description and Example don't show up on generated objects
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I want to show a description and example of fields of type object but the generated code leaves the example field null and the description field as an empty string (""). The preview of my openapi schema file shows those fields.
openapi-generator version
I'm using 7.2.0. I'm not sure if it's a regression but I did test with 6.6.0 as well and didn't see those fields populated
OpenAPI declaration file content or url
---
openapi: 3.0.1
info:
title: Payment Service API
description: Payments Platform Service REST Endpoints
version: 0.0.1
servers:
- url: http://localhost:8080
description: Local
paths:
"/payments/{chargeId}/capture":
post:
tags:
- payment-controller
operationId: capture
parameters:
- name: chargeId
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/CaptureCommand"
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
"$ref": "#/components/schemas/CaptureResponse"
components:
schemas:
CaptureCommand:
required:
- amount
- country
- payment_partner
- reference_id
type: object
properties:
country:
type: string
example: US
payment_partner:
type: string
example: citizens
amount:
type: integer
format: int32
description: amount in cents to be captured
example: 50
reference_id:
type: string
description: the ID of what the payment is against
example: orderID
financing_info:
$ref: "#/components/schemas/FinancingInfo"
CaptureResponse:
required:
- amount_paid
- payment_partner
- country
- status
- transaction_fee
type: object
properties:
amount_paid:
type: integer
format: int32
payment_partner:
type: string
example: citizens
country:
type: string
example: US
status:
$ref: "#/components/schemas/PaymentStatus"
transaction_fee:
type: integer
format: int32
PaymentStatus:
required:
- is_success
- message
- name
type: object
properties:
is_success:
type: boolean
message:
type: string
name:
type: string
FinancingInfo:
required:
- annual_percentage_rate
- financing_term
type: object
description: Required if Citizens is the Payment Partner
properties:
annual_percentage_rate:
type: number
example: 4.99
financing_term:
type: integer
example: 12
Command line used for generation
java -jar openapi-generator-cli.jar generate -i <PATH TO ABOVE FILE> -g kotlin-spring -o ~/temp/test2
Steps to reproduce
Using this command java -jar openapi-generator-cli.jar generate -i <PATH TO ABOVE FILE> -g kotlin-spring -o ~/temp/test2 and then looking at the src/main/kotlin/org/openapitools/model/CaptureCommand.kt the financingInfo has example as null and description as ""
Related issues/PRs
Suggest a fix/enhancement
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
Run the documented openapi-generator command with the provided schema, then inspect src/main/kotlin/org/openapitools/model/CaptureCommand.kt and the FinancingInfo model it references. Compare the generated financingInfo metadata with the schema's description and examples; done means the generated object fields expose the expected description and example values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin, spring
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100