swagger_parser library

Provides generation functions that generates REST clients and data classes from OpenApi definition file swagger_parser

Classes

FillController
Handles generating files
GeneratedFile
Used to store information for generating files
Generator
Handles whole cycle of generation.
GeneratorConfig
The configuration that the Generator uses
GenProcessor
Handles whole cycle of generation. Can be provided with arguments to specify custom path to yaml config.
OpenApiInfo
Information about the API
OpenApiParser
General class for parsing OpenApi specification into universal models
ParserConfig
The configuration that the OpenApiParser uses
ReplacementRule
Used to store regex patterns for replacing names during generation
SWPConfig
Swagger Parser Config
UniversalComponentClass
Universal template for containing information about component
UniversalDataClass
Universal template for containing information about component
UniversalEnumClass
Universal template for enum
UniversalEnumItem
Universal template for enum item
UniversalRequest
Universal template for containing information about Request
UniversalRequestType
Universal template for containing information about Request parameter
UniversalRestClient
Universal template for containing information about Rest client
UniversalType
Universal template for containing information about type

Enums

HttpParameterType
Type of parameter in rest client
HttpRequestType
Request type
JsonSerializer
Used for select json serializer for dto
OAS
All versions of the OpenApi Specification that this package supports
ProgrammingLanguage
Enumerates supported programming languages to determine templates
UniversalCollections
Defines collections wrapping type

Extensions

StringTypeX on String
Extension for utils

Functions

protectDefaultEnum(Object? name) String?
Protect default enum value from incorrect symbols, keywords, etc.
protectDefaultValue(Object? name, {String? type, bool isEnum = false, bool isArray = false, bool dart = true}) String?
Protect default value from incorrect symbols, keywords, etc.
protectEnumItemsNames(Iterable<String> names) Set<UniversalEnumItem>
Protect enum items names from incorrect symbols, keywords, etc.
protectJsonKey(String? name) String?
Protect JsonKeys from incorrect symbols, keywords, etc.
protectName(String? name, {String? description, bool uniqueIfNull = false, bool isEnum = false, bool isMethod = false}) → (String?, String?)
Protect name from incorrect symbols, keywords, etc.
resetUniqueNameCounters() → void
In general, it is worth putting the processing of class names, methods, fields. in some separate layer from the parser and templates, so as not to write such crutches with a reset The reset itself is needed to update the status during tests.
uniqueName({bool isEnum = false}) String
Unique name for object classes

Exceptions / Errors

ConfigException
Exception thrown when a config is not correct
GeneratorException
Exception thrown when in generator is not correct
OpenApiParserException
Exception thrown when a parser can't parse the specification