Skip to content

Annotations

@api

Exposes the annotated element to the public API. Elements that have not been annotated with @api are only visible and available from within NPL, and are therefore not callable via the API and are ignored by the code generator.

This annotation may be applied to protocols and actions.

The Example protocol below shows the @api annotation in all supported places.

@api
protocol[p] ApiAnnotationProtocol(t: Text) {
    var n: Number = 1;

    @api
    permission[p] exposed() {
    };
}

@multinode

Signals to the Operating Engine that this is a multinode message. The presence of this annotation means the engine will automatically handle it.

@multinode
notification GetNameForCustomerId(id: Number) returns Text;

@test

Indicates that a function is a unit test. This annotation may only be applied to top-level functions in test resources.

@test
function sampleTest(test: Test) -> {
    test.assertEquals(true, true);
}

@deprecated

Indicates that the given NPL element is deprecated and will be removed in an upcoming release. Warnings are issued at compile time. An optional message can be provided as a Text parameter. This annotation may only be applied to top-level: function, enum, struct, identifier, union, and symbol.

@deprecated
enum MyDeprecatedEnum { E1, E2 };

@deprecated
struct MyDeprecatedStruct { };

@deprecated
identifier MyDeprecatedId;

@deprecated
union MyDeprecatedUnion { Text };

@deprecated
symbol MyDeprecatedSymbol;

@deprecated("message")
function deprecatedFunction() -> {
    var x = 10;
}

@experimental

Indicates that the given NPL element is experimental and is therefore unstable. Warnings are issued at compile time. An optional message can be provided as a Text parameter. This annotation may only be applied to top-level: function, enum, struct, identifier, union, and symbol.

@experimental
enum MyExperimentalEnum { E1, E2 };

@experimental
struct MyExperimentalStruct { };

@experimental
identifier MyExperimentalId;

@experimental
union MyExperimentalUnion { Text };

@experimental
symbol MyExperimentalSymbol;

@experimental("message")
function experimentalFunction() -> {
    var x = 10;
}