Skip to content

Comments

FGA_BASE: adding base types and module registraiton#556

Open
swaroopAkkineniWorkos wants to merge 7 commits intomainfrom
ENT-5224-python-sdk-for-fga-worktree-fuck-around
Open

FGA_BASE: adding base types and module registraiton#556
swaroopAkkineniWorkos wants to merge 7 commits intomainfrom
ENT-5224-python-sdk-for-fga-worktree-fuck-around

Conversation

@swaroopAkkineniWorkos
Copy link

Description

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@linear
Copy link

linear bot commented Feb 19, 2026

@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title adding base types and module registraiton FGA_BASE: adding base types and module registraiton Feb 20, 2026
@swaroopAkkineniWorkos
Copy link
Author

@greptile review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Added foundational types and HTTP client support for the FGA (Fine-Grained Authorization) base module. This PR introduces four new authorization type models (Resource, RoleAssignment, AccessEvaluation, and AuthorizationOrganizationMembership) that properly integrate with the existing type system. The PR also refactored OrganizationMembershipStatus into a shared file to avoid duplication between user management and authorization modules.

Key changes:

  • Added new authorization type models with proper Pydantic validation
  • Implemented delete_with_body() method for both sync and async HTTP clients to support DELETE requests with JSON payloads
  • Added comprehensive test coverage for all new types and HTTP client methods
  • Properly registered new types in the ListableResource TypeVar for pagination support

Confidence Score: 5/5

  • Safe to merge with no issues identified
  • All changes are well-structured type definitions and HTTP client enhancements with comprehensive test coverage. No security concerns, proper type safety, and follows existing patterns in the codebase
  • No files require special attention

Important Files Changed

Filename Overview
src/workos/types/authorization/access_evaluation.py Added AccessEvaluation model with authorized boolean field
src/workos/types/authorization/organization_membership.py Added AuthorizationOrganizationMembership model that imports shared OrganizationMembershipStatus type
src/workos/types/authorization/resource.py Added Resource model for authorization resources with proper optional fields
src/workos/types/authorization/role_assignment.py Added RoleAssignment model with nested RoleAssignmentRole and RoleAssignmentResource models
src/workos/types/user_management/organization_membership_status.py Created new file with shared OrganizationMembershipStatus type definition
src/workos/utils/_base_http_client.py Added force_include_body parameter to support DELETE requests with JSON body
src/workos/utils/http_client.py Added delete_with_body method to both sync and async HTTP clients

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class WorkOSModel {
        <<BaseModel>>
    }
    
    class Resource {
        +string object
        +string id
        +string external_id
        +string name
        +Optional~string~ description
        +string resource_type_slug
        +string organization_id
        +Optional~string~ parent_resource_id
        +string created_at
        +string updated_at
    }
    
    class RoleAssignment {
        +string object
        +string id
        +RoleAssignmentRole role
        +RoleAssignmentResource resource
        +string created_at
        +string updated_at
    }
    
    class RoleAssignmentRole {
        +string slug
    }
    
    class RoleAssignmentResource {
        +string id
        +string external_id
        +string resource_type_slug
    }
    
    class AccessEvaluation {
        +bool authorized
    }
    
    class AuthorizationOrganizationMembership {
        +string object
        +string id
        +string user_id
        +string organization_id
        +string organization_name
        +OrganizationMembershipStatus status
        +Optional~Mapping~ custom_attributes
        +string created_at
        +string updated_at
    }
    
    WorkOSModel <|-- Resource
    WorkOSModel <|-- RoleAssignment
    WorkOSModel <|-- RoleAssignmentRole
    WorkOSModel <|-- RoleAssignmentResource
    WorkOSModel <|-- AccessEvaluation
    WorkOSModel <|-- AuthorizationOrganizationMembership
    
    RoleAssignment --> RoleAssignmentRole
    RoleAssignment --> RoleAssignmentResource
Loading

Last reviewed commit: a5823c6

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

13 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

from workos.types.workos_model import WorkOSModel
from workos.typing.literals import LiteralOrUntyped

OrganizationMembershipStatus = Literal["active", "inactive", "pending"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated OrganizationMembershipStatus literal

This exact same Literal["active", "inactive", "pending"] type alias is already defined in src/workos/types/user_management/organization_membership.py:7. Consider importing from a shared location or re-exporting from one module to the other to avoid the definitions drifting apart over time.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pushed up a change where I moved "OrganizationMembershipStatus" to it's own file to be imported

@swaroopAkkineniWorkos swaroopAkkineniWorkos marked this pull request as ready for review February 23, 2026 17:52
@swaroopAkkineniWorkos swaroopAkkineniWorkos requested a review from a team as a code owner February 23, 2026 17:52
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant