Repository navigation
Add A ResourceID Component For Record Inputs - #65
Merged
Merged
Conversation
Every input that names a record now references one ResourceID schema, a record's URL or its ID, after probing each one with a bare ID: 20 query filters, the estimate and invoice fields on item create, and 41 payload fields. The 38 inline path id parameters become one shared Id parameter on ResourceID, described as refusing a URL, and UserId points at it too. Credit note item id refuses a URL and stays ID-only; journal entry stock_item and property can't be probed and stay URL-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generator parses a 3.0 spec with OpenAPIKit30, whose schema reference keeps only whether it is required, so a description beside a $ref never reached the generated doc comments. Under 3.1.0 OpenAPIKit keeps it, and a $ref's siblings are valid. The nine ResourceID field descriptions now show in the doc comments; the generated code is otherwise unchanged, and the spec uses no 3.0-only keyword. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches ResourceID: the shared path parameter is ID (ID.yaml) and the self assessment one UserID (UserID.yaml), with every reference updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
The CLI sends bare IDs to nearly every input that names a record, and FreeAgent accepts them, but the spec said so in only three places. Every such input was a plain string with a full-URL example. This adds one
ResourceIDschema - a record's URL or its ID - and uses it for every input that names a record, after probing each one with a bare ID.contact,project,user,task,invoiceandbank_accounton every list that takes them, pluscreateTask's?project.contact,project,category,user,task,bank_account,bank_transaction,paid_bill,paid_invoice,paid_user,capital_asset_type, and the item and entryurls - plusestimateandinvoiceon item create.idparameters become one sharedIDparameter, as the self assessmentuser_idalready was. Its schema isResourceID, and its description says a path refuses the URL. That one is renamedUserIDto match, and points atResourceIDtoo.$refs still reach the generated doc comments. See below.id, which refuses a URL, and journal entrystock_itemandproperty, which the sandbox can't test.What The Sandbox Showed
Probed under the pinned
X-Api-Version: 2026-09-01, no header and2024-10-01; nothing differs between them. Every probe record was deleted, and the opening balances set's test entries were removed again.user_idpath is a 404 with an encoded URL.projectfilters with no data had a probe project made for them.invoiceon estimates was tested with an estimate sent and converted.user, opening balancecontact, and explanationpaid_user,paid_billandcategoryon update. The rest were already proven when the CLI switched toResourceID(Accept An ID Or URL Everywhere #49) and in later coverage PRs.idrefuses a URL. A full item URL is a 404 for both an update and_destroy; the bare ID works. It stays ID-only, and its description now says so.stock_itemandpropertyare untested. The sandbox has no stock items or properties, so they stay URL-only.Code
components/schemas/ResourceID.yaml: a string, "A record's URL or its ID", with example'1'.components/parameters/ID.yaml: the shared pathid, replacing an inline copy in 17 path files.createTask'sproject,BillItemPayload.urlandJournalEntryPayload.url, since the schema says it now.JournalEntryPayload.categorysays a category's ID is its nominal code.ResourceIDgenerates as aSwift.Stringtypealias, and theIDandUserIDparameters as aliases of it, so every caller compiles as before. The generator names the firstComponents.Parameters.Id, as its idiomatic naming does with an all-caps name; nothing refers to it.OpenAPI 3.1.0
The spec moves from
openapi: 3.0.3to3.1.0, so that the field descriptions beside a$refreach the generated doc comments.$ref, such asInvoiceCreatePayload.project's "Must belong to the contact, or the create is a 422". The bundler keeps it. The generator parses a 3.0 spec with OpenAPIKit30, though, whose schema reference holds only whether it is required, so the description was dropped while parsing. 3.0 also says a$ref's siblings are ignored.$refare valid. All nine now show in the doc comments.Types.swiftandClient.swiftare identical to the 3.0.3 output. The spec uses none of the 3.0-only keywords (nullable, booleanexclusiveMinimum,binaryorbyteformats).$refinallOfwould also have kept the descriptions, but it generates avalue1wrapper struct per field, which breaks every caller.Tests
Client.swiftis byte-identical to the one generated frommain, and the types differ only by names that stand forSwift.String.createInvoicewith a 500. The suite passes on its own.filing_statusdiffered between list and show, while the suite's mark-filed test toggles that same return in parallel.changed-suitesselects both suites, so CI may hit them too.🤖 Generated with Claude Code