Skip to content

[BUG] [JAVA] [ASCIIDOC] Bug with filtering nulls in examples #17149

@JkbLskw

Description

@JkbLskw

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

Examples in models are always presented despite an existence test. If the element does not exist, null is represented as a value.
The marking of the required fields correctly displays non-existent elements as an empty values.

openapi-generator version

7.0.1

OpenAPI declaration file content or url

A json-example like this

...
"Content": {
  "type": "object",
  "properties": {
	  "content": {
		  "type": "array",
		  "description": "Content of Document in Bytes",
		  "items": {
			  "type": "string",
			  "description": "Content of Document in Bytes",
			  "format": "byte"
		  }
	  }
  },
  "description": "Content of Document"
}
...

with a mustache-template like this

[#{{classname}}]
=== _{{classname}}_ {{title}}

{{unescapedDescription}}

[.fields-{{classname}}]
[cols="2,3,1,2,2"]
|===
| Name| Description| Required| Type| Example

{{#vars}}
| {{baseName}}
| {{description}}
| {{#required}}✓{{/required}}
| {{dataType}} {{#isContainer}} of <<{{complexType}}>>{{/isContainer}}
| {{#example}}{{.}}{{/example}}

{{/vars}}
|===

creates a asciidoc-output like this

[#Content]
=== _Content_ 

Content of Document

[.fields-Content]
[cols="2,3,1,2,2"]
|===
| Name| Description| Required| Type| Example

| content
| Content of Document in Bytes
| 
| List  of <<ByteArray>>
| null

|===

but expected should it be like this

[#Content]
=== _Content_ 

Content of Document

[.fields-Content]
[cols="2,3,1,2,2"]
|===
| Name| Description| Required| Type| Example

| content
| Content of Document in Bytes
| 
| List  of <<ByteArray>>
|

|===

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions