Repository navigation
Generate the OneDrive template from Microsoft Graph's OpenAPI description - #322
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 0ac8d25 | Nov 23 2026, 10:35 AM |
tnkuehne
force-pushed
the
feat/onedrive-template
branch
2 times, most recently
from
November 23, 2026 00:35
a73d01e to
e722349
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 00:46
e722349 to
d3692bd
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 01:16
fe1d095 to
9b5389b
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 01:31
4106254 to
cf77f08
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 01:43
cf77f08 to
20ef547
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 02:01
20ef547 to
f246533
Compare
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 10:05
1f7ada3 to
4655d27
Compare
…tion The OneDrive template offered three hand-written methods: list and search files and get a download link. It now offers 40 typed methods for OneDrive's operations of Microsoft Graph: drives, folders and items, search and delta, content, versions and check-out, sharing and following. A new OpenAPI generator writes them. Large APIs like Graph describe far more than one template offers, so a template lists the operations it offers by operation ID, with method names and the change each non-GET operation makes. The generator reads JSON or YAML, emits only the types the offered operations reach, leaves out Graph's navigation properties, and supports Graph's paging links, file downloads through their temporary address, and text uploads. Changes ask for approval by each user's level. The connector requests Files.ReadWrite.All, and accounts connected with fewer permissions are asked to reconnect.
Like the other templates, OneDrive returns too_large for responses and file content larger than 8 MiB instead of reading them into memory, and leaves out optional arguments passed as undefined.
… steps An operation's parameter replaces the path's parameter of the same name and place instead of adding a second field. Nullable component types stay nullable, path parameters are never null, and a required body is checked before anything is sent. Path values of . or .. are rejected, since they would move the request to another path.
Required query parameters are checked before sending. An object's other keys take a type that also fits its named fields, unions keep the null of a nullable enum when string covers its values, and splitting unions leaves quoted values whole.
…address Inputs that would share a name and object query parameters stop generation instead of producing code that cannot compile or send. A JSON body or result without a schema takes any JSON. Only the schemas the offered methods reach need distinct type names, and generated names stay free for the imports and the service class. Pageable methods accept either their first-page arguments or only the address of a later page.
…ther keys Query lists with explode false are joined with the delimiter of their style: commas for form, spaces and pipes for the delimited styles; other styles stop generation. A nullable object that only has other keys stays an object type instead of becoming null.
A path holds one value, so generation stops on path parameters that take a list or an object instead of offering inputs the runtime would reject.
A nextLink must lead to a page of the same operation: its path with any parameter values, and for functions such as delta() any arguments, so a link cannot read other data than the method does. Generated method names are checked against Widefleet's own app method rule, which also refuses names such as catch, finally and queue.
tnkuehne
force-pushed
the
feat/onedrive-template
branch
from
November 23, 2026 10:16
4655d27 to
6779fca
Compare
tnkuehne
added a commit
that referenced
this pull request
Nov 23, 2026
…ription (#326) ## Why Outlook mail and calendars are the Microsoft counterpart to Gmail and Google Calendar, and no template covers them yet. The OpenAPI generator from #322 and the Microsoft login of the OneDrive template cover most of it. What remains is the list of operations and two things Graph's description needs. ## What changes **Outlook template** (`templates/outlook`) - **Methods:** 68 typed methods for the signed-in user's mailbox. `scripts/operations.ts` names the Graph operation behind each one. - **Mail:** messages, MIME content, delta, drafts, send, reply, reply all and forward (direct and as drafts), move, copy, and attachments. - **Folders and rules:** mail folders, child folders and their messages, and inbox rules. - **Calendar:** calendars, events and calendar views, recurring instances, meeting responses (accept, tentative, decline, cancel, forward), reminders, `findMeetingTimes` and `getSchedule`. - **Contacts and settings:** contacts and contact folders, mailbox settings, and categories. - **Approvals:** each user's approval level decides when a method asks. - **Send:** sending, replying and forwarding mail, creating events (which invites attendees), and answering, cancelling or forwarding meetings. - **Update:** inbox rules, which can forward mail, and mailbox settings, which include automatic replies. - **Create:** drafts, folders, contacts and calendars. - `findMeetingTimes` and `getSchedule` read through a POST and never ask. - **Scopes:** `Mail.ReadWrite`, `Mail.Send`, `Calendars.ReadWrite`, `Contacts.ReadWrite` and `MailboxSettings.ReadWrite`, from the managed Microsoft client or the organization's own Entra app. An account connected with fewer permissions gets `permission_required`. - **Results and limits:** the same as OneDrive: `graph_error`, throttling, `too_large` over 8 MiB, and paging through `nextLink`. - **Icon:** a plain envelope icon, not Microsoft's logo. - `template.md` describes setup, well-known folder names, OData options, action bodies, approvals, results and how to offer more operations. **OpenAPI generator** - **`read` rule:** rules can mark POST operations that only read, such as `getSchedule`. - **`body`/`result` rule:** rules can name the schemas a body or result can be, where Graph only names their common base. `addAttachment` and `getAttachment` use file, item and reference attachments, so `contentBytes` is typed. - **`navigation` rule:** rules can keep named navigation properties, typed with their concrete schemas. Outlook's `Message.attachments` carries file, item and reference attachments inline, for `sendMail` and drafts. - **`description` rule:** rules can replace an operation's description. Graph attaches the text of other operations to some Outlook ones: `me.ListMessages` says "Get open extension" and `me.CreateEvents` says "Create multi-value extended property". Seven methods use it. **Managed OAuth tests** - Outlook runs through the managed OAuth tests next to OneDrive. ## Managed OAuth A managed `microsoft` client only grants the scopes its `scopes` setting allows. Installations that offer managed OAuth for Microsoft must allow these five scopes, next to OneDrive's `Files.ReadWrite.All` from #322. ## Notes - **Action bodies:** they use the parameter names of Graph's description, which are PascalCase, such as `{ Message, SaveToSentItems }` for `sendMail`. Graph's own SDKs send these names. ## Connection page New page, connected state, with the same approval form as the other templates. | 1280 px | 390 px | | --- | --- | | <img src="https://gist.githubusercontent.com/tnkuehne/2e857c8b70cfc0a62168609f2702355e/raw/1cc8a17af5f63629af575aa9cfaeeaaffa688e95/outlook-after-1280.png" width="400"> | <img src="https://gist.githubusercontent.com/tnkuehne/2e857c8b70cfc0a62168609f2702355e/raw/1cc8a17af5f63629af575aa9cfaeeaaffa688e95/outlook-after-390.png" width="200"> | ## Testing - `pnpm check` - **Generator:** tests for `read` and `description` rules. - **Outlook template against a mocked Graph:** - typed requests and URLs; - paging; - MIME content; - `getSchedule` never asking; - drafts running at once, and `sendMail` and deletions asking, then running after approval; - each approval level; - missing permissions, with and without the Graph resource prefix; - Graph errors, throttling and oversized responses; - token refresh, outages and callback checks. - **Type tests:** the README example compiles; a missing ID and wrong query types don't. - **Managed OAuth and catalog tests:** pass with Outlook. - Not tested against a live Microsoft account. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=116087758&sig=ece23a325ff22d3121927e11de7e8a94e67354b241876b0c7d54f855e71798bb"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F326&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5 <sup><img alt="Tier: plus" title="Review tier: plus" src="https://greptile-static-assets.s3.amazonaws.com/badges/effort-plus.svg?v=3" height="12"></sup></h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no new actionable issue was established. <details open><summary><h3>Summary</h3></summary> Adds 68 typed Outlook methods, Microsoft account connections, approval controls, and managed OAuth tests. The OpenAPI generator gains rules for read-only POSTs, concrete body and result types, kept navigation fields, and descriptions. - Outlook apps can call typed methods for mail, calendars, contacts, and settings. - Outlook asks before methods send messages or make protected changes. - Each signed-in user can connect and use their own Microsoft account. - The template generator can describe Outlook’s read-only actions and concrete attachment types. - Managed Microsoft OAuth can allow the scopes Outlook needs. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[App calls Outlook method] --> B[Check request arguments] B --> C[Check current user's connection] C --> D{Change needs approval?} D -->|Yes, no answer| E[Ask user] E --> A D -->|Declined| F[Return declined] D -->|Approved or not needed| G[Send request to Microsoft Graph] G --> H[Return bounded data or error] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (16) · Last reviewed commit: ["Fit kept navigation fields into the type..."](0c01043) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
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.
Why
The OneDrive template offers three hand-written methods: list files, search files, get a download link. Uploading, moving, sharing or restoring files needs a template change. Microsoft Graph publishes an OpenAPI description, but it covers all of Microsoft 365: 18,094 operations and 5,367 schemas. A template can only offer a chosen part of it. Outlook, Jira, Confluence and other REST APIs need the same kind of generator.
What changes
OpenAPI generator (
packages/template-generator/src/openapi.ts)yamlis already a dependency of the app builder and the control plane.microsoft.graph.driveItembecomesDriveItem.allOfbecomes an intersection, and Graph's nullableanyOfbecomesT | null.stringalready covers are dropped.@odata.typeare optional, because the server adds them.drive-idbecomesdriveId.$topand$select.null, and nullable component types keepnull.BinaryContent,UploadContentor the service class.nextLink. It must be an address on the API's origin, such as@odata.nextLinkor@odata.deltaLink.Shared REST runtime (
runtime/rest.ts)search(q='it''s');{ downloadUrl }, so the app never fetches the file;{ contentType, data }..and.., which would move the request to another path. The Google runtime rejects them too.too_large, as in the other templates.undefinedare left out.contentType.OneDrive template
Methods: 39 typed methods: drives, root, items and children, search, recent items, delta, content download and upload, upload sessions, thumbnails, previews, versions, check-in and check-out, permissions, links, invitations, and following.
scripts/operations.tsnames the Graph operation behind each one. Graph'ssharedWithMeis left out: Microsoft stops it returning data after November 2026.Approvals: per-user approval level, like in the other templates.
create.update.delete.send.Scope:
Files.ReadWrite.Allinstead ofFiles.Read. An account connected with fewer permissions getspermission_requiredfrom every method and fromconnectionStatus. Graph scopes are accepted with or without their resource prefix.Errors:
graph_errorwith Graph'scode,messageand HTTP statusRetry-Afterrate_limitedreconnect_requiredRemoved:
listFiles,searchFilesandgetDownloadUrl, with their helpers.template.mddescribes addressing by drive and item ID, OData options, paging, downloads and uploads, approvals, results and how to offer more operations.Managed OAuth
A managed
microsoftclient only grants the scopes itsscopessetting allows. Installations that offer managed OAuth for Microsoft must allowFiles.ReadWrite.Allthere. Until they do, starting a managed connection fails with "The requested scopes are not allowed for this client". Installations with their own Entra application need the delegatedFiles.ReadWrite.Allpermission.Connection page
Connected state, with the same approval form as the other templates.
Not shown: the disconnected and setup-required states. They only change their description text.
Testing
pnpm checknextLink;

Confidence Score: 5/5 
The changes since the previous review appear safe to merge.Summary
Adds an OpenAPI generator and replaces OneDrive's hand-written methods with 39 typed operations.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["OpenAPI description + operation rules"] --> B["Generate typed methods and request table"] B --> C["Check arguments and build request"] C --> D{"Does this change need approval?"} D -->|Yes| E["Ask the user"] E -->|Approved| F["Send with the user's Microsoft token"] D -->|No| F F --> G["Microsoft Graph"] G --> H["Return bounded JSON, content or download URL"]Reviews (17) · Last reviewed commit: "Type every OpenAPI success answer, keep ..." · Reviewed by Greptile