Repository navigation
Fix a backwards relationship-linkage claim and three localhost links - #601
Open
karl-bullock wants to merge 1 commit into
Open
karl-bullock wants to merge 1 commit into
karl-bullock wants to merge 1 commit into
Conversation
Three pages in the published 2.x docs link to http://localhost:3000, someone's local Docusaurus dev server: extend/forms.md pointing at the admin settings section, and extend/update-2_0-api.md twice pointing at the relationship aggregates section. They are broken for every reader. All three are now relative links to the pages they meant. extend/api.md described relationship linkage backwards. It said "ToMany relationships are not linked by default contrary to ToOne relationships", which tells the reader that a ToOne relationship's identifier appears in the payload without asking for it. It does not: linkage is declared once on the shared Relationship base class as `public bool|Closure $linkage = false`, neither ToOne nor ToMany overrides it, and both serialize through the same hasLinkage() check. The only withLinkage() call anywhere in core or the bundled extensions is on a ToMany relationship. The sentence now says neither carries linkage by default, and notes that an included relationship carries its identifiers regardless, which is the part the original was reaching for. Verified against flarum/json-api-server 0.1.2, which is the top of the 0.1.x line that core's ^0.1.0 constraint resolves to. Also in update-2_0-api.md: three absolute https://docs.flarum.org/2.x/... self-links become relative, so that they are checked at build time and do not take a redirect hop, and one in admin.md pointing at the mail page does the same. A stray backtick that terminated a code sample mid-line is removed, its orphaned second code block merged into the first, and "re-used inn different places" corrected.
This branch has not been deployed
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.
Findings from reading
extend/api.mdandextend/update-2_0-api.mdagainst the source claim by claim, rather than checking that the symbols exist. Two of these are real bugs; the rest are small things found in the same passes.Three
localhost:3000links are publishedextend/forms.mdandextend/update-2_0-api.md(twice) link tohttp://localhost:3000, which is somebody's local Docusaurus dev server. They are broken for every reader of the site. All three now point at the pages they meant, relatively:forms.mdtoadmin.md#registering-settingsupdate-2_0-api.md, both occurrences, toapi.md#relationship-aggregatesThe relationship linkage claim is backwards
api.mdsaid:That tells the reader a
ToOnerelationship's identifier appears in the payload without asking for it. It does not. Linkage is declared once, on the sharedRelationshipbase class:Neither
ToOnenorToManyoverrides it, and both serialize through the samehasLinkage($context)check. The onlywithLinkage()call anywhere in core or the bundled extensions is on aToManyrelationship (postsonDiscussionResource), which is the opposite of what the sentence implies.The replacement says neither carries linkage by default and that
withLinkageis how you opt in, and keeps the useful part the original was reaching for by noting that a relationship actually included in a response carries its identifiers regardless. The performance caution aboutToManylinkage immediately below it is correct and untouched.Checked against
flarum/json-api-server0.1.2, which is the highest release in the0.1.xline that core's^0.1.0resolves to, so it is what a 2.0 install actually gets.Smaller things in the same pages
https://docs.flarum.org/2.x/...self-links inupdate-2_0-api.md, and onehttps://docs.flarum.org/mailinadmin.md, are now relative. They did resolve, but only via a redirect hop, and an absolute link is invisible to the build's link checker, so it cannot be caught if a page moves. Relative links are checked at build time and work in a local build and in previews.update-2_0-api.md, leaving an orphaned second code block immediately after it with no text between the two. The backtick is gone and the two samples are merged into one, with a comment separating them.What I checked and did not need to change
Worth recording, so the same ground is not covered twice:
flarum/framework@2.xplus thejson-api-servervendor package. Everything resolves. The names that initially looked missing were PSR-7 and Eloquent methods, thescopeWhereVisibleToEloquent scope, or third-partyfof/gamificationandfof/draftscode deliberately shown as the 1.x "before".paginate(20, 50)matches the real defaults (paginate(int $defaultLimit = 20, int $maxLimit = 50)), and its inline comment is accurate.postsrelation models" is correct:DiscussionResource'sShowendpoint listsfirstPostandlastPostindefaultIncludeand notposts.countRelationandsumRelationexist with the documented signatures.extensions/audit.mdwas checked separately: both documented permissions and all ten documented action names exist in the extension's source.