---
description: When editing auto-generated files or adding new API methods/models
globs: ["model_*.go", "api_open_fga.go", "streaming.go", "internal/constants/constants.go"]
---

Parts of this SDK are auto-generated via [OpenAPI Generator](https://openapi-generator.tech) from [sdk-generator](https://github.com/openfga/sdk-generator). Generated files are wiped on every regeneration.

## Generated files

- `model_*.go` (data model files)
- `api_open_fga.go` (low-level API client, deprecated in favor of `api_executor.go`)
- `streaming.go` (NDJSON streaming handler)
- `internal/constants/constants.go` (batch limits, retry config, user agent — consistent across all OpenFGA SDKs)
- `docs/**` (API reference markdown files)

Identify generated files by the header: `NOTE: This file was auto generated by OpenAPI Generator ... DO NOT EDIT.`

## If you need to change a generated file

Contributors may modify generated files in this repo, but changes must be sourced from sdk-generator:

1. Submit the changes to [sdk-generator](https://github.com/openfga/sdk-generator) first
2. Link the sdk-generator PR in this repo's PR description
3. The FGA team will regenerate and push updated files — unlinked changes to generated files will be overwritten

## Key rules

- New API methods go in `api_executor.go` (hand-written), not `api_open_fga.go` (generated)
- New data models/constants tied to the API spec go through sdk-generator
- SDK-specific constants not tied to the spec go in hand-written files
- golangci-lint excludes generated files by design (`.golangci.yaml`) — do not remove this exclusion
- Generated files are not unit tested directly; tests exercise the SDK interfaces that use generated types
