Repository navigation
Required fields: what a POST needs to save a new item - #10
Open
HermanPeeren wants to merge 1 commit into
Open
HermanPeeren wants to merge 1 commit into
HermanPeeren wants to merge 1 commit into
Conversation
Each minimal POST example was sent to a Joomla 6.2 site, and the causes were checked in joomla-cms 6.2-dev. A field whose database column has no default is required: without it, saving fails with "Field 'x' doesn't have a default value". - Banners: description, custombannercode and params are required. The minimal example used catid 1, which creates a new banner category titled "1"; it now uses 3. - Content languages: image, description and metadesc are required; the example lang_code was invalid. - Menu items: alias is required (an empty string is accepted); without it the path is null and saving fails. Administrator items also need link. type lists the accepted types: an unknown type gives a 500. - Articles: introtext or articletext is required. - Required JSON objects (params, images, metadata) get minProperties 1: the form filter drops an empty object. Users: groups gets minItems 1. - Administrator menus and modules: client_id is not set by the route; without it a site menu or module is saved. - Media files: the mediatypes query parameter is described; the minimal example uploads a PNG. - Redirects: the minimal example no longer uses the same old and new URL. - Messages: POST saves the message but answers 404.
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
requiredlists and minimal examples of POST request bodies now match what Joomla needs to save a new item. I sent each minimal example to a Joomla 6.2 site, then left out each required field in turn, and checked the causes in joomla-cms6.2-dev. Any field whose database column has no default is required. Without it, saving fails with "Field 'x' doesn't have a default value".description,custombannercodeandparamsare required. The minimal example usedcatid1, which is not a banner category, so Joomla created a new banner category titled "1". It now uses 3.image,descriptionandmetadescare required. The examplelang_codewas invalid.aliasis required, and an empty string is accepted.MenuTable::check()copies the alias intopathbeforestore()makes an alias from the title, so with no aliaspathis null and the insert fails. Administrator items also needlink.typenow has an enum: an unknown type, as in the old example, gives a 500 because noitemadmin_<type>.xmlform exists.introtextorarticletextis required (anyOf).paramsof banners, fields, modules and template styles;images,metadataandparamsof newsfeeds):minProperties: 1. The form filter drops an empty object, or one that has only unknown keys, so the column stays null.groupsgetsminItems: 1.client_idwas described as "fixed by the route", but the route does not set it. Without it, Joomla saves a site menu or a site module, and for the module it answers 404.mediatypesquery parameter is now described. Without it, only image extensions are accepted, so the old.txtexample failed. The minimal example now uploads a 1×1 PNG.Notes for the reviewer
fix/request-defaults) in two places: the## Unreleasedsection of the CHANGELOG, and the minimal example ofPOST /v1/redirects. Both branches addpublished; this branch also changes the URLs. Whichever branch merges second needs a short rebase.contacts/form/{id}(it sends mail) or thejoomlaupdatePOSTs (they start an update).Not fixed here (possible follow-ups)
POST /v1/languages/overrides/site/{lang_code}wrote toadministrator/language/overrides/en-GB.override.ini, and the response had an emptyid. The spec's claim that POST takesappandlang_codefrom the route looks wrong. Not investigated further.PATCH /v1/menus/site/items/{id}with only{"published": -2}gives a 500.contextanswers 404, but it still saves a field with an empty context.