Implementation/64530 extend project api to consider calculated values #20133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/64530
What are you trying to accomplish?
Offer a way to interact with calculated values using the API.
There were two possibilities of representing calculated values in the API:
After multiple discussions and brainstorming, I went with the second approach. The main reason is that calculated values have a assigned custom value that is a constant - not an ID to relating to another model. The latter is required to properly build an API around it. We don't get that here, so we would have to either blow up the entire implementation by defining an actual model for calculated values - or we need to treat it like a pseudo-resource within the API. I didn't like either of these options. The only thing that sets calculated values apart from a float is that they contain a formula and may produce errors. This is not enough to justify the mention measures. Meaning:
nil
.Caveats
All of the above could be addressed by providing a proper project custom field API that offers mostly the same features as the Web UI. The current implementation aims to integrate calculated values into the current API structure as well as possible.
Examples
Project schema response (excerpt):
Project response (excerpt):
Merge checklist