Repository navigation
Response attributes: add id and relationship fields that the API views render - #6
Merged
HermanPeeren merged 1 commit intoNov 18, 2026
Conversation
…s render Checked every GET, POST and PATCH response against the field lists of the API views in joomla-cms (6.2.0 and 6.3-dev, whose API code is the same): - id added to the attributes of 104 responses on 64 paths; 68 of them have additionalProperties: false, so a real response did not validate. - created_by, modified_by, tags and (contacts) user_id added as attributes of articles, contacts and newsfeeds; Joomla renders them as attributes as well as relationships. - urls removed from the article list attributes: the list query does not select it. - articletext: no effect on update; introtext and fulltext win over it on create.
Merged
HermanPeeren
added a commit
that referenced
this pull request
Nov 18, 2026
info.version is 6.2.2; CHANGELOG.md has the 6.2.2 section with the changes of #6.
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 response schemas miss attributes that Joomla renders. This PR adds them, after checking every GET, POST and PATCH response against the field lists of the API views in joomla-cms. It was checked against 6.2.0 and
6.3-dev(18 Nov 2026); the API code of the two is the same.How Joomla builds the attributes
JsonApiViewpasses$fieldsToRenderItemor$fieldsToRenderListof the view (api/components/<component>/src/View/<View>/JsonapiView.php) to the serializer.JoomlaSerializer::getAttributes()returns the properties of the item that are in that list. Therelationshipscome separately from$relationship, so a field can be both. POST (add) and PATCH (edit) end withdisplayItem(), so their responses have the attributes of the item.A script compared, for each operation, the view of its controller (from
x-source) with the response schema. Result: 104 operations on 64 paths miss attributes, and no response has attributes the view does not render. Where the 6.2.0 test site has data, the captured responses confirm it.Changes
idadded to 104 responses on 64 pathsEvery view renders
id; for messages the view copies it frommessage_id. It was missing in:mailfields, and the PATCH responses of the other field paths.68 of these schemas have
additionalProperties: false, so a real response did not validate against the spec. A test with a response that hasattributes.idfails before this PR for messages, redirects and newsfeeds, and passes after it.Relationship fields that are also attributes
/v1/content/articles(list, POST),/{id}(GET, PATCH)created_by,tags;modified_byon item, POST and PATCH/v1/contacts(list, POST),/{id}(GET, PATCH)created_by,modified_by,tags,user_id/v1/newsfeeds/feeds(list, POST),/{id}(GET, PATCH)created_by,modified_by;tagson item, POST and PATCHcategoryis in these field lists too, but the item has nocategoryproperty (onlycatid), so it stays a relationship only.tagsis an object{ "<tag id>": "<title>" }, or[]when there are no tags.getTagNames(), which are ordered by title (array_combine). With more than one tag, a title can be paired with the wrong ID. The description says so; that is a Joomla issue.tagsis always[].Other fixes
urlsremoved from the article list attributes.ArticlesModel::getListQuery()does not selecta.urls, so it never appears in a list.articletextin the article request bodies. On PATCH,ApiController::save()fills the storedintrotextandfulltextinto the request data.Content::bind()splitsarticletextand thenparent::bind()overwrites the split with those values. Soarticletexthas no effect on update, and on create anintrotextorfulltextsent with it wins.CHANGELOG.mdhas an "Unreleased" section with these changes;info.versionis unchanged.Checks
npm run check: format, OpenAPI 3.1 schema and Redocly lint pass. Quality has 0 errors and the same 274 warnings asmain.