Repository navigation
Request defaults: what the webservices do with an omitted field - #9
Open
HermanPeeren wants to merge 2 commits into
Open
HermanPeeren wants to merge 2 commits into
HermanPeeren wants to merge 2 commits into
Conversation
Checked on a Joomla 6.2 site and against the install SQL of joomla-cms 6.2-dev: - POST: the webservices do not apply the defaults of the administrator forms; an omitted field gets the default of its database column. state/published is 0, not 1 (articles, banners, banner clients, categories, contacts, fields, field groups, content languages, menu items, modules, newsfeeds, tags); track_impressions/track_clicks of banners and banner clients are -1, not 0; numarticles of newsfeeds is 1, not 5. - POST /v1/redirects: published is required, as its column has no default. - PATCH: an omitted field keeps its stored value, so the default of the 131 top-level properties of PATCH request bodies is removed. The form default stays in x-joomla-form.default. - GET /v1/content/articles: list[ordering] and list[direction] are described.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The request bodies took their
defaultvalues from the administrator forms. The webservices do not apply those, so several defaults were wrong. Checked on a Joomla 6.2 site (by creating items without the field) and against the install SQL of joomla-cms6.2-dev.Create (POST): an omitted field gets the default of its database column.
state/publishedtrack_impressions,track_clicksnumarticlesFor articles, the description limits this to sites with workflows disabled, which is what was tested.
publishedof a redirect is now required: its column has no default, so saving without it fails with "Field 'published' doesn't have a default value". The example includes it.Update (PATCH): an omitted field keeps its stored value (
ApiController::save()loads it, and the application configuration merges the current configuration). Thedefaultof the 131 top-level properties of PATCH request bodies is removed, so that generated clients and "Try it out" do not send it and overwrite the stored value. The form default stays inx-joomla-form.default.Article list:
list[ordering]andlist[direction]had no description. They now list the accepted columns. A value that is not a filter field of the model is ignored; the filter fieldsauthor_id,category_id,level,tag,publishedandstageare no columns of the query and give an internal server error (500). Omitted, the list is ordered by id (or by the featured ordering whenfilter[featured]is 1), descending; an invalid direction gives ascending.npm run checkpasses. After the change, creating each item without the defaulted fields returns exactly the defaults in the spec, for every field the response contains.