Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 of 6 tasks
JkbLskw opened this issue Nov 20, 2023 · 0 comments
Open
4 of 6 tasks

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

JkbLskw opened this issue Nov 20, 2023 · 0 comments

Comments

@JkbLskw
Copy link

JkbLskw commented Nov 20, 2023

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>>
|

|===
karlo0 pushed a commit to karlo0/openapi-generator that referenced this issue Feb 16, 2025
…e values wrongly to the string value "null" instead of the expected not set value
wing328 pushed a commit that referenced this issue Feb 17, 2025
…ngly to the string value "null" instead of the expected not set value (#20670)

Co-authored-by: Karsten Leonhardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant