Skip to content

Comments

IonPath supports single-line documentation comments that attach to the declaration immediately following them.

Syntax

Comments use // and can span multiple consecutive lines:

// Represents a user account in the system.
// Contains basic profile information.
msg User {
    // The unique identifier for this user.
    id: u4;

    // The display name, visible to other users.
    name: string;

    // Email address. Null if the user hasn't set one.
    email: string?;
}

Comment Attachment

Comments attach to the next declaration in the file. They can appear before:

  • Messages, services, unions, enums, flags, typedefs
  • Fields within messages and unions
  • Methods within services
  • Members within enums and flags

In Generated Code

Comments are preserved as XML documentation in C# and JSDoc in TypeScript:

// C# output
/// <summary>
/// Represents a user account in the system.
/// Contains basic profile information.
/// </summary>
public sealed class User { ... }

// TypeScript output
/**
 * Represents a user account in the system.
 * Contains basic profile information.
 */
export interface User { ... }