-
Notifications
You must be signed in to change notification settings - Fork 85
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
Example null values ignored by ExampleBuilder #371
Comments
refs #371 - better null example handling, new `x-inflector-null-example` extension processing
handled/fixed in #375, where some changes have been introduced (fixes and/or workarounds) Going through the use cases of the test PR (also available in the merged PR): 1st case:
we cannot easily handle and we won't, we cannot differentiate between missing and null examples; this is a general (i.e. not limited to swagger) known issue usually in scope of applying patches/updates, and has no simple solution In order to work around this issue if badly needed, we have introduced processing of an extension The call is activated by calling ExampleBuilder with the additional parameter processNullExtension as There is another added parameter see the test and the test definition in the PR for usage. 2nd case:
These cases were different than the first case, and a fix has solved them. UPDATEspecific update of tool chain (swagger-core and swagger-parser) for the example field alone to implement the "set flag" mentioned above turned out to be somehow easier than expected, and PR #377 will add support for null examples without needing extensions; this will be merged when an unrelated issue with tests and latest parser version gets fixed (#376) related PRs: |
refs #371 - better null example handling using updated core and parser - also update dependencies
When using in
null
values in example schemas the result returned byExampleBuilder
is not returning true null values. There seems to be a couple of things at play here.The first is that if a
StringExample
is null the default value"string"
is returned so for the following spec we don't get the expectednull
value returned:Expected return value:
null
Actual return value
The second issue seems to be arising from
io.swagger.v3.core.util.Json.pretty(java.lang.Object)
where null values are being returned as a string of value"null"
. For example:Expected return value:
Actual return value
I have created a failing unit test that demonstrates this behaviour and more examples here -> #370
The text was updated successfully, but these errors were encountered: