Skip to content

ENABLED

Enable endpoint globally or conditionally based on tags.

Overview

By default, endpoints are enabled. This annotation is used to:

  • Explicitly enable an endpoint that was previously disabled
  • Conditionally enable an endpoint only when it has specific tags

Tags are automatically assigned based on routine source (function volatility, CRUD operation type). See TAGS for the complete list of automatic tags.

Keywords

enabled

Syntax

enabled
enabled <tag1> [tag2] [tag3] ...
  • Without tags: Enables the endpoint unconditionally
  • With tags: Enables the endpoint only when it has at least one of the specified tags

Examples

Enable Globally

sql
comment on function my_func() is
'HTTP
enabled';

Enable Only for Immutable Functions

sql
-- Enable endpoint only when the function is immutable
comment on function calculate_total(_items json) is
'HTTP GET
enabled immutable';

Enable for Specific CRUD Operations

sql
-- On a table, only enable read operations
comment on table audit_log is
'enabled select read get';

This enables the SELECT endpoint but not INSERT, UPDATE, or DELETE.

Enable for Beta Features

sql
comment on function beta_feature() is
'HTTP
enabled beta testing';

Endpoint is only available when the routine has beta or testing tags.

Combine with Other Annotations

sql
comment on function stable_api() is
'HTTP GET
disabled
enabled stable immutable
cached';

First disables the endpoint globally, then re-enables it only for stable and immutable functions.

Behavior

  • When used without tags, unconditionally enables the endpoint
  • When used with tags, enables only if the endpoint has at least one matching tag
  • Multiple enabled annotations can be used in the same comment
  • Tags include automatic tags from routine source (volatility, CRUD type) and custom tags
  • Case-insensitive tag matching
  • DISABLED - Disable endpoint globally or by tags
  • TAGS - Automatic tags and conditional annotation application

Released under the MIT License.