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

Fixes #2619 News export API empty value handling #2620

Merged
merged 3 commits into from
Aug 23, 2023
Merged

Conversation

tadean
Copy link
Contributor

@tadean tadean commented Jul 28, 2023

Description

For some of the API fields, az_quickstart/export/az_news/v1/az_news.json represents empty values as [ ], when the value of the equivalent non-empty field is normally a json object containing the field properties (this includes fields like field_az_media_thumbnail_image, field_az_enterprise_attributes and field_az_media_image.)

This PR changes handling of those fields to produce null rather than [ ] when those fields are empty. This is to increase data type consistency of the API.

Discussion for review: is null or an empty object (rather than an array) preferable?

update: the PR has been updated to instead provide an empty object { } , rather than null.

Related issues

Closes #2619

How to test

  • enable az_news_export az_enterprise_attributes_import
  • Create news data
  • Verify some data has images and others do not
  • Verify that some data has enterprise attributes and others do not
  • Visit az_quickstart/export/az_news/v1/az_news.json and verify that empty field values produce null rather than [ ]

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
    • Adding experimental module
    • Update experimental module
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Upgrade experimental module to stable
    • Enable existing module by default or database update
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown
    • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown
    • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown
    • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tadean tadean added enhancement New feature or request Integrations This relates to an integration into a central service. 2.7.x only trellis Work associated with Trellis labels Jul 28, 2023
@tadean tadean requested a review from a team as a code owner July 28, 2023 15:11
@tadean tadean self-assigned this Jul 28, 2023
joeparsons
joeparsons previously approved these changes Jul 28, 2023
@joeparsons joeparsons added patch release Issues to be included in the next patch release needs discussion Further discussion required to determine requirements labels Jul 28, 2023
@tadean
Copy link
Contributor Author

tadean commented Aug 17, 2023

Updated with an alternate experimental approach that adds a Normalizer service that ensures that properties the schema defines as json objects will still be serialized as objects when empty.

@tadean
Copy link
Contributor Author

tadean commented Aug 23, 2023

Kim Rosema on the Trellis team reported that the current approach in this PR of providing an empty object seems to resolve the issue with the integration on their end.

@joeparsons joeparsons merged commit 7e8cb57 into main Aug 23, 2023
14 checks passed
@joeparsons joeparsons deleted the feature/2619 branch August 23, 2023 17:58
danahertzberg added a commit that referenced this pull request Aug 29, 2023
* Fixes #2619 News export API empty value handling (#2620)

* Closes #2677: Fix broken Google Tag config upgrade. (#2678)

* Fixes #2680 News Content Topic and Audiences Attributes only (#2681)

* Closes #2549 remove horizontal scroll in mobile browsers when off canvas nav buttons appear on the page. (#2673)

* Closes #2645: Add events to Quickstart for Marketing Cloud module (#2666)

---------

Co-authored-by: tadean <51835841+tadean@users.noreply.github.com>
Co-authored-by: Joe Parsons <471936+joeparsons@users.noreply.github.com>
Co-authored-by: Chris Green <chrisgreen@arizona.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7.x only enhancement New feature or request Integrations This relates to an integration into a central service. needs discussion Further discussion required to determine requirements patch release Issues to be included in the next patch release trellis Work associated with Trellis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

News Export empty value handling
3 participants