Comlink Profile
Version 2023.01.16
Introduction
/Typed semantic profile/
/Use‐case description language/
Comlink Profile is a simple format for describing application use‐cases. It enables you to describe the business behavior of an application without the need to go into detail of implementation.
The profile language was designed with distributed systems applications in mind but can be used for describing any use cases or even for modeling entire domains using the DDD approach.
Unlike other formats (E.g. Gherkin) Profile does not support the description of actors, roles, or pre‐requisites.
Contrary to pure semantic profiles (e.g. ALPS) Superface Profile allows adding a type overlay for defined models to allow for the creation of rich developer experiences.
By convention, one profile file should comprise of one use case (E.g. “Get weather” or “Make payment”).
When submitted to a profile store, the profile must be assigned a globally unique identifier in the form URL (preferably de‐reference‐able).
1Profile Document
Example № 1name = "meteo/get-weather"
version = "1.0.0"
usecase GetWeather {
...
}
Example № 2name = "meteo/get-weather"
version = "1.0.0"
usecase GetWeather {
...
}
model WeatherInformation {
...
}
Example № 3name = "meteo/get-weather"
version = "1.0.0"
usecase GetWeather {
...
}
model WeatherInformation {
...
}
field location Place
2Description
Any definition in the profile document can have a preceding human‐readable description. Any string literal or block string literal preceding a definition is treated as a description.
Example № 4"Use-case description"
usecase GetWeather {
...
}
Example № 5"""
Retrieve Weather Information
Use-case description
"""
usecase GetWeather {
...
}
3Use-case
safe | unsafe | idempotent |
Example № 6usecase GetWeather {
input {
location
units
}
result {
airTemperature
atmosphericPressure
}
}
Example № 7"""
Send Message
Send single conversation message
"""
usecase SendMessage unsafe {
input {
"To
recepient of the message"
to
"From
sender of the message"
from
channel
"Text
the text of the message"
text
}
result {
messageId
}
async result {
messageId
deliveryStatus
}
error {
problem
detail
instance
}
}
4Models
4.1Named Model
4.2Model Definition
4.2.1Object Model
Example № 8model WeatherInformation {
airTemperature
atmosphericPressure
}
The field definitions of an object model type MUST be separated by a newline or comma ,
:
Example № 9// Newline-separated
{
airTemperature
atmosphericPressure
}
// Comma-separated
{ airTemperature, atmosphericPressure }
4.2.2List Model
Example № 10model WeatherHistory [ WeatherInformation ]
4.2.3Enum Model
Example № 11model Channel enum {
sms
whatsapp
viber
}
Example № 12model Unit enum {
"Degrees of Celsius"
C = 'celsius'
"Degrees of Fahrenheit"
F = 'fahrenheit'
}
Example № 13model Values enum {
byte = 8
kiloByte = 1024
fourKiloBytes = 4096
}
Example № 14// Newline-separated
enum {
sms
whatsapp
viber
}
// Comma-separated
enum { sms, whatsapp, viber }
4.2.4Union Model
Example № 15model WeatherData WeatherHistory | WeatherInformation
4.2.5Alias Model
Example № 16model MyWeather WeatherInformation
4.2.6Scalar Model
Example № 17model Place
Scalar models can have a type overlay using one of the built‐in primitive types:
Example № 18model Place string
5Fields
5.1Named Field
5.2Field Definition
5.2.1Required field
By default all fields are optional. To declare field that is required use RequiredField after FieldName
Example № 19model User {
name! string // the field "name" is required (but can be None)
email string // the field "email" is optional
}
6Example
7Literal
7.1Comlink Literal
7.2None Literal
7.3Primitive Literal
" | \ | / | n | r | t |
7.4Object Literal
7.5Array Literal
8Types
8.1Primitive types
boolean | string | number |
8.2Required value
By default all values are optional. To declare value that cannot be None use RequiredValue after ModelDefinition
Example № 20model User {
name string! // value of name cannot be None
email string // value of email can be None
}
Example № 21usecase Example {
result string! // result must be of type string
}
9Language
9.1Source text
9.1.1Comments
Example № 22// This is a comment
9.1.2Line Terminators
9.2Common Definitions
9.2.1Identifier
9.2.2Profile Identifier
Identifier of a profile regardless its version.
Example № 23character-information
Example № 24starwars/character-information
9.2.3Full Profile Identifier
Fully disambiguated identifier of a profile including its exact version.
Example № 25character-information@2.0.0
Example № 26starwars/character-information@1.1.0
9.2.4Map Profile Identifier
Profile identifier used in maps does not include the patch number.
Example № 27starwars/character-information@1.1
9.2.5Provider Identifier
9.2.6Service Identifier
Service identifier form provider’s definition. Generally used for specifying a service base (host) URL.
9.2.7URL Value
9.2.8Security Scheme Identifier
References the security scheme found within a provider definition.
9.2.9String Value
" | \ | / | n | r | t |
9.2.10Integer Value
§Index
- AliasModel
- ArrayItemContinued
- ArrayItems
- ArrayLiteral
- AsyncResult
- BooleanLiteral
- CharacterLiteral
- ComlinkLiteral
- Comment
- CommentChar
- Description
- DigitBaseEight
- DigitBaseSixteen
- DigitBaseTen
- DigitBaseTwo
- DocumentNameIdentifier
- EnumElement
- EnumElementName
- EnumElementValue
- EnumModel
- Error
- EscapedCharacter
- Example
- ExampleError
- ExampleInput
- ExampleOutput
- ExampleResult
- FieldDefinition
- FieldName
- FieldSpecification
- FullProfileIdentifier
- Identifier
- Input
- IntegerValue
- KeyValueAssignment
- LHS
- LineTerminator
- ListModel
- MajorVersion
- MapProfileIdentifier
- MinorVersion
- ModelDefinition
- ModelName
- ModelReference
- ModelSpecification
- NamedField
- NamedModel
- NoneLiteral
- NumberLiteral
- NumberLiteralDigits
- NumberLiteralFloat
- NumberLiteralInteger
- NumberLiteralIntegerBaseEight
- NumberLiteralIntegerBaseSixteen
- NumberLiteralIntegerBaseTen
- NumberLiteralIntegerBaseTwo
- NumberSign
- ObjectLiteral
- ObjectModel
- PatchVersion
- PrimitiveLiteral
- ProfileDocument
- ProfileIdentifier
- ProfileName
- ProfileScope
- ProfileVersion
- ProviderIdentifier
- RequiredField
- RequiredValue
- Result
- Safety
- ScalarModel
- ScalarType
- SecuritySchemeIdentifier
- SemanticVersion
- ServiceIdentifier
- SourceCharacter
- StringCharacter
- StringLiteral
- StringValue
- URLValue
- UnionModel
- UnionModelReferenceList
- Usecase
- UsecaseName
- VariableKeyPath
- VariableName