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

[REF] APIv4 refactoring to support calculated fields #20440

Merged
merged 2 commits into from
May 31, 2021

Conversation

colemanw
Copy link
Member

Overview

This is a code refactor to make it possible to add ad-hoc fields to the api getfields spec.

Before

All APIv4 fields correspond to db columns for dao entities for the get action.

After

It's possible to add other fields. They will be ignored by the get api, so handling will need to be done elsewhere.

Technical Details

A big part of this refactor was to move options lookup to a callback function.

@civibot
Copy link

civibot bot commented May 29, 2021

(Standard links)

@civibot civibot bot added the master label May 29, 2021
@colemanw colemanw force-pushed the apiCalculatedField branch 2 times, most recently from f5691f8 to bda2f04 Compare May 29, 2021 23:53
This allows any fieldSpec provider to change the callback used to build field options,
or to add an ad-hoc field not in the schema with its own option getter.
@eileenmcnaughton
Copy link
Contributor

test this please

@colemanw colemanw force-pushed the apiCalculatedField branch from bda2f04 to e60149f Compare May 31, 2021 17:47
@eileenmcnaughton eileenmcnaughton merged commit 9bc987c into civicrm:master May 31, 2021
@eileenmcnaughton
Copy link
Contributor

Search kit & api explorer still seem to resolve options OK & we have pretty good test cover. I'll also throw this at our wmf unit tests

@eileenmcnaughton eileenmcnaughton deleted the apiCalculatedField branch May 31, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants