with one click
with one click
| name | webrpc-ridl-schema |
| description | webrpc schema and RIDL syntax |
Use this skill when the user needs to work with RIDL files.
The RIDL file defines schema for HTTP client/server communications (browser-to-server or service-to-service).
The webrpc-gen codegen generates a REST-like API with JSON messages, a subset of REST API conventions, which:
.ridl files; do not manually edit generated *.gen.* files.ridlfmt after edits when possible.webrpc = v1
name = <schema-name>
version = <schema-version>
basepath = <api-base-path>
import "path/to/file.ridl"
import "path/to/file.ridl" (TypeA, ServiceB)
Imports are merged into the current schema and can be limited to named members.
# starts a line comment.Core types:
byte, bool, any, null, string, timestamp,
uint8/16/32/64, int8/16/32/64, float32/64.
List:
[]Type, [][]Type
Map:
map<key,value>
Struct (message):
struct User
- id: uint64
- name?: string # optional field
Fields are required unless marked optional (?).
Enum:
enum SortOrder: uint32
- DESC = 0
- ASC = 1
If no explicit value is provided, enum values default by index.
service Example
- Ping()
- GetUser(userId: uint64) => (user: User)
Succinct form (single struct arg/return only, preferred):
service Example
- Ping(PingRequest) => (PingResponse)
- GetUser(GetUserRequest) => (GetUserResponse)
Do not mix succinct form with multi‑arg form in a single method.
error 100 RateLimited "too many requests" HTTP 429
error 200 UserNotFound "user not found"
Default HTTP status is 400 when omitted.
Methods can be annotated:
@deprecated:"use NewMethod instead"
@stampede:3s
Fields can include metadata lines:
- id: string
+ go.field.name = ID
+ go.field.type = uint64
+ go.tag.json = id,string
+ go.tag.db = id,omitempty
- createdAt: timestamp
+ go.tag.db = created_at,omitempty
- updatedAt: timestamp
+ go.tag.db = updated_at,omitempty
- deletedAt?: timestamp
+ go.tag.db = deleted_at,omitempty
- featureIndex: int
+ json = - # internal server-only field (omitted in clients)
_examples/golang-basics/example.ridl (small, clear schema)schema/README.md (type system)schema/ridl/README.md (errors and RIDL notes)webrpc = v1.message keyword instead of struct.? on nullable fields.