Description
The CommandableSwaggerDocument class allows you to generate Swagger code that describes created REST API methods and their parameters.
Constructors
Creates a new instance of the service.
CommandableSwaggerDocument(String baseRoute, ConfigParams? config, List<ICommand> commands)
- baseRoute: String - base route of the service
- config: ConfigParams? - configuration parameters
- commands: List<ICommand> - list of commmands.
Fields
Instance methods
getSpaces
Returns a string with spaces.
String getSpaces(int length)
- length: int - determines the length of the string with spaces.
- returns: String - string containing spaces.
toString
Returns string with Swagger code that describe service methods.
@override
String toString()
- returns: String - string with the API information.
typeToString
Returns a string with the type name.
String typeToString(dynamic type)
- type: dynamic - type (e.g. Integer)
- returns: String - name of the type (e.g. ‘integer’)
writeArrayItem
Writes an array item to Swagger code.
void writeArrayItem(int indent, String name, {bool isObjectItem = false})
- indent: int - number of spaces
- name: String - item’s name
- isObjectItem: bool - True is the item is an object. false otherwise.
writeAsObject
Adds a property and its value.
void writeAsObject(int indent, String name, dynamic value)
- indent: int - number of spaces
- name: String - name of the property
- value: dynamic - value of the property
writeAsString
Adds a string property and its string value.
void writeAsString(int indent, String name, String value)
- indent: int - number of spaces
- name: String - name of the property
- value: String - value of the property
writeData
Adds data to the Swagger code.
void writeData(int indent, Map<String, dynamic> data)
- indent: int - number of spaces
- name: String - name
- data: Map<String, dynamic> - data to be added
writeName
Write a property or object name.
void writeName(int indent, String name)
- indent: int - number of spaces
- name: String - string with added identation