Skip to content

fix: guard only undefined and empty strings#725

Merged
sserrata merged 1 commit intoPaloAltoNetworks:mainfrom
ImFlog:bug/too-restrictive-guard
Mar 12, 2024
Merged

fix: guard only undefined and empty strings#725
sserrata merged 1 commit intoPaloAltoNetworks:mainfrom
ImFlog:bug/too-restrictive-guard

Conversation

@ImFlog
Copy link
Contributor

@ImFlog ImFlog commented Feb 22, 2024

Description

Fixed the guard to allow anything not undefined or empty to avoid issues with boolean and 0 numbers.

Motivation and Context

Fix #724.

How Has This Been Tested?

  • Added unit tests for the utils file
  • Updated the demo project with a default value at 0 to see the impact. See screenshot for before and after changes.

Screenshots

Before the fix:
image

After the fix:
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@github-actions
Copy link

Visit the preview URL for this PR (updated for commit 608ca63):

https://docusaurus-openapi-36b86--pr725-0pfg359i.web.app

(expires Thu, 11 Apr 2024 13:20:54 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@sserrata sserrata merged commit cc5067d into PaloAltoNetworks:main Mar 12, 2024
@ImFlog ImFlog deleted the bug/too-restrictive-guard branch March 13, 2024 16:33
sserrata added a commit that referenced this pull request Mar 15, 2024
* feat: implement  x-tagGroup feature (#737)

* impement redoc's x-tagGroup feature

* merge main

* update documentation

* fix filtered tags by group

* remove tracked .idea files

* add  option to readme

* merge main

* fix lint

* revert yarn.lock and linter

* cleanup missing types, dup imports and add restaurant example

* fix: Guard only undefined and empty strings (#725)

* Conditional display of header Request (#719)

Co-authored-by: Christian A. Mathiesen <christian@zaveit.no>

* update lock file

* feat: Implement schema pages behind a config option `showSchemas` (#736)

* feat: Implement schema pages behind a config option `showSchemas`

* Add `showSchemas` to petstore demo

* address linter errors

* enable schemas for petstore

* update lock file

* add missing heading import

* address linter errors

---------

Co-authored-by: Çağrı S <bencagri@users.noreply.github.com>
Co-authored-by: Florian Garcia <garcia.florian.perso@gmail.com>
Co-authored-by: chranmat <cam@mathix.net>
Co-authored-by: Christian A. Mathiesen <christian@zaveit.no>
Co-authored-by: Marc L <littlemarc2020@gmail.com>
@pmarschik
Copy link

This breaks the guard(..) calls for:

  • SchemaItem: required, deprecated, nullable (all of them booleans)
  • ParamsItem: required (boolean)

That means all of those flags are always interpreted as true and all of the styles for them are applied.
For required which is always either true or false, all schema items are shown as required.
Deprecated and nullable are working if they are undefined but not if explicitly set to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default value of 0 is not rendered

3 participants