| name | repo-website-api-update |
| description | Update existing API documentation when Formisch source code changes. Use when function signatures, types, interfaces, or JSDoc comments change in the library source. |
| metadata | {"author":"formisch","version":"1.0"} |
Updating API Documentation
API documentation must stay synchronized with source code. When functions, types, or interfaces change in the Formisch packages, update the corresponding documentation.
Key Principle: Source code is the single source of truth. Documentation must never deviate from what's actually implemented.
When to Update
Update documentation when:
- Function signatures change - New/removed parameters, type changes, generic constraints
- Interfaces change - New/modified/removed properties
- JSDoc comments change - Descriptions, param docs, hints
- Behavior changes - Validation logic, error messages, defaults
- Deprecations or renames - Functions deprecated or renamed
Do NOT update when:
- Only internal implementation changes
- Private/internal functions change
- Test files change
- Non-JSDoc comments change
Update Process
Step 1: Understand the Changes
Compare source code changes:
git diff HEAD~1 packages/core/src/path/to/file.ts
Categorize changes:
- Breaking changes: Signature changes, removed parameters
- Additions: New parameters, overloads, properties
- Documentation changes: JSDoc updates
- Behavioral changes: Logic affecting usage
Step 2: Find Affected Documentation
Locate files to update:
/website/src/routes/(docs)/{framework}/api/{category}/{ApiName}/
├── index.mdx
└── properties.ts
Step 3: Update properties.ts
Ensure types match new source code:
TInput
TInput extends string | number
TInput: {
modifier: 'extends',
type: {
type: 'union',
options: ['string', 'number'],
},
},
Step 4: Update index.mdx
- Front matter: Update
source path if file moved
- Function signature: Match new signature exactly
- Generics section: Add/remove/update generics
- Parameters section: Add/remove/update parameters
- Explanation: Update if behavior changed
- Examples: Update to use new API correctly
- Related section: Update cross-references
Step 5: Update Related Files
- Type documentation: If interfaces changed
- menu.md: If function renamed/moved
- Guide files: If usage patterns changed
Common Change Scenarios
Adding a Parameter
Source change:
export function validate(form: FormStore): void;
export function validate(form: FormStore, config?: ValidateConfig): void;
properties.ts update:
config: {
type: {
type: 'union',
options: [
{ type: 'custom', name: 'ValidateConfig', href: '../ValidateConfig/' },
'undefined',
],
},
},
index.mdx update:
- Update function signature
- Add to Parameters section
- Update Explanation to mention new parameter
- Add examples using new parameter
Removing a Parameter (Breaking)
- Remove from properties.ts
- Update function signature in index.mdx
- Remove from Parameters section
- Update all examples
- Consider adding migration note
Changing Types
Source change:
TRequirement extends number
TRequirement extends number | string
properties.ts update:
TRequirement: {
modifier: 'extends',
type: {
type: 'union',
options: ['number', 'string'],
},
},
Adding Interface Properties
Update type documentation:
received: {
type: 'string',
},
Update index.mdx Definition section:
- `StringIssue` <Property {...properties.BaseIssue} />
- `kind` <Property {...properties.kind} />
- `type` <Property {...properties.type} />
- `received` <Property {...properties.received} /> <!-- Added -->
Function Renamed
- Rename folder:
mv /api/oldName /api/newName
- Update properties.ts references
- Update all occurrences in index.mdx
- Update menu.md (maintain alphabetical order)
- Update guide files
- Update related API docs that reference this function
Deprecation
Add deprecation notice after description:
# oldFunction
Creates a form store.
> **⚠️ Deprecated**: Use <Link href="../newFunction/">`newFunction`</Link> instead. This function will be removed in v2.0.
Link Updates
Cross-Package Links (Use Absolute)
href: '/core/api/FormSchema/';
href: '../../../core/api/FormSchema/';
Qwik Routing (Exclude Parentheses)
href: '../FormStore/';
href: '../(types)/FormStore/';
Verification Checklist
Source Code Accuracy
Type Links
Examples
Consistency
Cleanup
Quick Reference
Properties.ts Pattern for Optional Parameter
config: {
type: {
type: 'union',
options: [
{ type: 'custom', name: 'Config', href: '../Config/' },
'undefined',
],
},
},
Multiple Overloads in Signature
\`\`\`ts
const result = fn<TSchema>(form);
const result = fn<TSchema, TPath>(form, config);
\`\`\`
Type Reference Rules
Reference generic parameter names, not base types:
generics: [{ type: 'custom', name: 'TFieldPath' }];
generics: [{ type: 'custom', name: 'RequiredPath' }];