swagger_parser_core 1.0.0
swagger_parser_core: ^1.0.0 copied to clipboard
Typed Swagger and OpenAPI models with JSON/YAML parsing, validation, and reference resolution for swagger_parser.
swagger_parser_core #
OpenAPI parsing, validation, reference resolution, and normalization for
swagger_parser. Also works as a standalone library.
Supports Swagger 2.0 and OpenAPI 3.0.x, 3.1.x, and 3.2.x in JSON or YAML. Runs on VM and web. Does not generate Dart code.
Install #
dependencies:
swagger_parser_core: ^1.0.0
Run dart pub get.
Parse #
import 'package:swagger_parser_core/swagger_parser_core.dart';
final document = const OpenApiParser().parse(SchemaSource(text));
final report = const OpenApiValidator().validate(document);
final json = document.toJson();
text contains JSON or YAML. Use SchemaSource.json or SchemaSource.yaml
to require one format. Parsing returns an immutable, version-specific document.
Errors include the source URI, JSON Pointer, and available coordinates.
See the guide for input bytes, parser settings, external references, and normalization. See CONTRIBUTING.md for checks.