|
|
@ -13,6 +13,7 @@ import 'package:dynamite/src/builder/state.dart'; |
|
|
|
import 'package:dynamite/src/helpers/dart_helpers.dart'; |
|
|
|
import 'package:dynamite/src/helpers/dart_helpers.dart'; |
|
|
|
import 'package:dynamite/src/models/openapi.dart' as openapi; |
|
|
|
import 'package:dynamite/src/models/openapi.dart' as openapi; |
|
|
|
import 'package:dynamite/src/models/type_result.dart'; |
|
|
|
import 'package:dynamite/src/models/type_result.dart'; |
|
|
|
|
|
|
|
import 'package:version/version.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class OpenAPIBuilder implements Builder { |
|
|
|
class OpenAPIBuilder implements Builder { |
|
|
|
@override |
|
|
|
@override |
|
|
@ -44,9 +45,8 @@ class OpenAPIBuilder implements Builder { |
|
|
|
_ => throw StateError('Openapi specs can only be yaml or json.'), |
|
|
|
_ => throw StateError('Openapi specs can only be yaml or json.'), |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
final supportedVersions = ['3.0.3', '3.1.0']; |
|
|
|
if (Version.parse(spec.version).major != 3) { |
|
|
|
if (!supportedVersions.contains(spec.version)) { |
|
|
|
throw Exception('Only OpenAPI 3.0.0 and later are supported'); |
|
|
|
throw Exception('Only OpenAPI ${supportedVersions.join(', ')} are supported'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final state = State(spec.info.title); |
|
|
|
final state = State(spec.info.title); |
|
|
|