App-scoped `PolicyCreateParams` / `PolicyUpdateParams` missing fields

Open
#2,718 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
api

Research direction

Start with cloudflare/resources/zero-trust/access/applications/policies.d.ts and compare its PolicyCreateParams and PolicyUpdateParams with cloudflare/resources/zero-trust/access/policies.d.ts. Then trace how the OpenAPI access_app_policy_request, access_policy_req, and access_base_policy_req allOf chain is generated. Done means the app-scoped types expose the supported name, decision, include, require, and exclude fields without losing existing fields.

Written by the indexing model from the issue text.

Description

Confirm this is a Typescript library issue and not an underlying Cloudflare API issue
  • This is an issue with the Typescript library
Describe the bug

App-scoped PolicyCreateParams / PolicyUpdateParams missing name, decision, include, require fields

The app-scoped policy endpoints (POST /accounts/{account_id}/access/apps/{app_id}/policies and PUT .../{policy_id}) accept name, decision, include, require, and exclude in the request body — inherited via the access_app_policy_request → access_policy_req → access_base_policy_req allOf chain in the OpenAPI spec.

However, the generated TypeScript types at cloudflare/resources/zero-trust/access/applications/policies.d.ts only include:

export interface PolicyCreateParams {
  account_id?: string;
  zone_id?: string;
  approval_groups?: Array<...>;
  approval_required?: boolean;
  isolation_required?: boolean;
  precedence?: number;
  purpose_justification_prompt?: string;
  purpose_justification_required?: boolean;
  session_duration?: string;
  // name, decision, include, require, exclude are missing
}

The account-level policy types at cloudflare/resources/zero-trust/access/policies.d.ts correctly include all fields:

export interface PolicyCreateParams {
  account_id: string;
  decision: DecisionParam;           // ✓
  include: Array<AccessRuleParam>;   // ✓
  name: string;                      // ✓
  require?: Array<AccessRuleParam>;  // ✓
  exclude?: Array<AccessRuleParam>;  // ✓
  // ...
}

It looks like the code generator isn't resolving the allOf inheritance chain for the app-scoped variant.


This report generated by Claude

To Reproduce
  1. Try to use all parameters that are supported
  2. Get Type Error
Code snippets

OS

Windows

Runtime version

Bun 1.3.9

Library version

v5.2.0

Dominant language
TypeScript
Stars
835
Forks
201
Avg merge
41m
Merged PRs (30d)
1

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cloudflare-typescript

All issues in cloudflare/cloudflare-typescript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.