talk
Compile-to-source protocol contract specification language
Supported languages
- Java
- Objective-C
- JavaScript
- C#
- Swift
Example directory structure
talk
└───classes
│ │ user.talk
│ │ order.talk
│ │ ...
│
└───targets
│ target-objc.talk
│ target-java.talk
The class
folder contains all the talk files that define classes, constants, and enumerations.
The targets
folder contains the files that indicate what target source languages to make.
Example target file
The target.talk file allows specifiy how each target output is handled.
-
@language
specifies the language to output -
@destination
specicies the location to create files, relative to where themaketalk
command was issues. -
@map
keyword allows for remapping a property name to prevent reserved keyword clashes. -
@meta
Allows for defining meta tags each language can make use of. -
@rootclass
optionally specify a root object that allTalkObject
s inherit from. -
@template
optionally use a template file to generate output, each language can implement this differently. -
@prune
keeps the working directory clean by removing anything that wasn't conditionally written by the maketalk run.
@target objc
@description iOS/OS X Objective-C target
@language objc
@destination Talk/autogenerated
@map field User id identifier
@map field UpdatePassword newPassword changedPassword
@meta namespace true
@prune true
@end
@target swift
@description iOS/OS X Swift target
@language swift
@destination Talk/swift/autogenerated
@rootclass TalkObject
@map field Options map theMap
@meta namespace true
@meta classprefix XYZ
@meta mapper tailor
@prune true
@end
Example Talk File
@class com.acres4.common.info.talktest.TalkSmorgasbord
A test object used for testing serialization and deserialization of many different datatypes.
@field string stringField
Use me to test implementation of strings.
@field int8 int8field
Use me to test implementation of int8.
@field int16 int16field
Use me to test implementation of int16.
@field int32 int32field
Use me to test implementation of int32.
@field int64 int64field
Use me to test implementation of int64.
@field uint8 uint8field
Use me to test implementation of unsigned integers.
@field uint16 uint16field
Use me to test implementation of unsigned integers.
@field uint32 uint32field
Use me to test implementation of unsigned integers.
@field uint64 uint64field
Use me to test implementation of unsigned integers.
@field bool boolField
Use me to test implementation of booleans.
@field real realField
Use me to test implementation of floating points.
@field object objectField
Contains an arbitrary object that may or may not be a Talk object.
@field talkobject talkObjectField
Contains an arbitrary Talk object.
@field TalkExample specificTalkObjectField
Contains a specific kind of Talk object.
@field int32[] int32array
Contains an array of int32s.
@field int32{} int32dictionary
Contains a dictionary of int32s.
@field talkobject{} talkObjectDictionary
Contains a dictionary of arbitrary talk objects
@field TalkExample{} specificTalkObjectDictionary
Contains a dictionary of a specific kind of talk object
@field talkobject[] talkObjectArray
Contains an array of arbitrary talk objects
@field TalkExample[] specificTalkObjectArray
Contains an array of a specific kind of talk object
@field TalkExample[][] nestedArray
Use me to test implementation of nested arrays
@field TalkExample{}{} nestedDictionary
Use me to test implementation of nested dictionaries
@field TalkExample[]{} mixedMess
Use me to test implementation of mixed dictionaries and arrays
@end
Usage
maketalk --target objc path/to/talk/files