-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Description
When using nested expand() calls without explicit select(), the library generates an empty $select= statement which FileMaker OData cannot parse.
Reproduction
import { fmTableOccurrence, textField, containerField, FMServerConnection } from "@proofkit/fmodata";
const Parent = fmTableOccurrence("Parent", {
_pk: textField().primaryKey().entityId("FMFID:1"),
}, {
entityId: "FMTID:1",
navigationPaths: ["Child"],
});
const Child = fmTableOccurrence("Child", {
_pk: textField().primaryKey().entityId("FMFID:2"),
data: textField().entityId("FMFID:3"),
}, {
entityId: "FMTID:2",
navigationPaths: ["Parent"],
});
const connection = new FMServerConnection({
serverUrl: "https://example.com",
auth: { username: "test", password: "test" },
});
const db = connection.database("Test.fmp12", { useEntityIds: true });
// This generates invalid URL
const query = db
.from(Parent)
.get("test-id")
.expand(Child);
console.log(query.getQueryString());
// Output: /FMTID:1('test-id')?$select=FMFID:1&$expand=FMTID:2($select=)
// ^^^^^^^^^ empty selectExpected behavior
Either:
- Omit
$select=entirely when no fields are selected - Or include all fields by default
Actual behavior
Generates $select=) which causes FileMaker OData to return:
OData error: Error: parse failure in URL at: ')'
Workaround
Explicitly call .select() with at least one field on every expand:
const query = db
.from(Parent)
.get("test-id")
.expand(Child, (b) => b.select({ data: Child.data }));Environment
- @proofkit/fmodata version: 0.1.0-beta.24
- FileMaker Server OData API
Metadata
Metadata
Assignees
Labels
No labels