SWPConfig class
Swagger Parser Config
Constructors
-
SWPConfig.new({required String outputDirectory, String? schemaPath, String? schemaUrl, String name = 'api', ProgrammingLanguage language = ProgrammingLanguage.dart, JsonSerializer jsonSerializer = JsonSerializer.jsonSerializable, bool rootClient = true, String rootClientName = 'RestClient', String? clientPostfix, bool exportFile = true, bool putClientsInFolder = false, bool enumsToJson = false, bool unknownEnumValue = true, bool markFilesAsGenerated = true, bool originalHttpResponse = false, List<
ReplacementRule> replacementRules = const [], String defaultContentType = 'application/json', bool extrasParameterByDefault = false, bool dioOptionsParameterByDefault = false, bool pathMethodName = false, bool mergeClients = false, bool enumsParentPrefix = true, List<String> skippedParameters = const <String>[], bool generateValidator = false, bool useXNullable = false, bool useFreezed3 = false, bool useMultipartFile = false, String? fallbackUnion}) -
Creates a SWPConfig.
const
- SWPConfig.fromYaml(YamlMap yamlMap, {bool isRootConfig = false, SWPConfig? rootConfig})
-
Creates a SWPConfig from
YamlMap
.factory
Properties
- clientPostfix → String?
-
Optional. Set postfix for client classes and files.
final
- defaultContentType → String
-
DART ONLY
Default content type for all requests and responses.
final
- dioOptionsParameterByDefault → bool
-
DART ONLY
Add dio options parameter to all requests.
final
- enumsParentPrefix → bool
-
Set 'true' to set enum prefix from parent component.
final
- enumsToJson → bool
-
DART ONLY
Optional. Set
true
to include toJson() in enums. If set tofalse
, serialization will use .name instead.final - exportFile → bool
-
DART ONLY
Optional. Set
true
to generate export file.final - extrasParameterByDefault → bool
-
DART ONLY
Add extra parameter to all requests. Supported after retrofit 4.1.0.
final
- fallbackUnion → String?
-
DART ONLY
Optional. Set fallback consctructor name to use fallbackUnion parameter when using Freezed annotation.
final
- generateValidator → bool
-
Set
true
to generate validator for freezed.final - hashCode → int
-
The hash code for this object.
no setterinherited
- jsonSerializer → JsonSerializer
-
DART ONLY
Optional. Current available serializers are: json_serializable, freezed, dart_mappable.
final
- language → ProgrammingLanguage
-
Optional. Sets the programming language.
Current available languages are: dart, kotlin.
final
- markFilesAsGenerated → bool
-
Optional. Set
false
to not put a comment at the beginning of the generated files.final - mergeClients → bool
-
Set
true
to merge all clients in single client.final - name → String
-
Optional. Set API name for folder and export file
If not specified, the file name is used.
final
- originalHttpResponse → bool
-
DART ONLY
Optional. Set
true
to wrap all request return types with HttpResponse.final - outputDirectory → String
-
Required. Sets output directory for generated files (Clients and DTOs).
final
- pathMethodName → bool
-
If
true
, use the endpoint path for the method name. iffalse
, useoperationId
.final - putClientsInFolder → bool
-
Optional. Set
true
to put all clients in clients folder.final -
replacementRules
→ List<
ReplacementRule> -
Optional. Set regex replacement rules for the names of the generated classes/enums.
All rules are applied in order.
final
- rootClient → bool
-
DART ONLY
Optional. Set 'true' to generate root client
with interface and all clients instances.
final
- rootClientName → String
-
DART ONLY
Optional. Set root client name.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaPath → String?
-
Sets the path directory of the OpenApi schema.
final
- schemaUrl → String?
-
Sets the url of the OpenApi schema.
final
-
skippedParameters
→ List<
String> -
List of parameter names that should skip during parsing
final
- unknownEnumValue → bool
-
DART ONLY
Optional. Set
true
to maintain backwards compatibility when adding new values on the backend.final - useFreezed3 → bool
-
Set
true
to use Freezed 3.x code generation syntax. Setfalse
to maintain compatibility with Freezed 2.xfinal - useMultipartFile → bool
-
DART ONLY
Optional. Set
true
to use MultipartFile instead of File as argument type for file parameters.final - useXNullable → bool
-
Set
true
if Schema uses x-nullable to indicate nullable fieldsfinal
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toGeneratorConfig(
) → GeneratorConfig - Convert SWPConfig to GeneratorConfig
-
toParserConfig(
{required String fileContent, required bool isJson}) → ParserConfig - Convert SWPConfig to ParserConfig
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited