Skip to content

Compiler Pragmas

XIDL supports #pragma xidlc ... directives to provide extra configuration for the compiler and generators.

#pragma xidlc ...

Sets the package name, which maps to OpenAPI info.title:

#pragma xidlc package rev-tunnel
#pragma xidlc package "rev-tunnel"

Sets the package version, which maps to OpenAPI info.version:

#pragma xidlc version v1.0.0
#pragma xidlc version "1.0.0"

Declares an API endpoint with a service name. The name is optional and defaults to the endpoint:

#pragma xidlc service <api-endpoint> [api-name]

Example:

#pragma xidlc package E2E HTTP Stream Test
#pragma xidlc version v1.0.0
#pragma xidlc service http://127.0.0.1:8080 dev server
#pragma xidlc service http://127.0.0.1:8081 product

This defines a package named E2E HTTP Stream Test with version v1.0.0, containing two services: dev and product.