openapi_dart 0.1.3 copy "openapi_dart: ^0.1.3" to clipboard
openapi_dart: ^0.1.3 copied to clipboard

An OpenAPI JSON Spec Parser, fromJson and toJson

example/openapi_dart_example.dart

import 'package:openapi_dart/openapi_dart.dart';
import 'dart:io';

void main() async {
  List<String> jsonFileNameList = [];
  jsonFileNameList.add("api-with-examples.json");
  jsonFileNameList.add("callback-example.json");
  jsonFileNameList.add("link-example.json");
  jsonFileNameList.add("non-oauth-scopes.json");
  // jsonFileNameList.add("petstore-expanded.json");  //allOf, oneOf, anyOf UNSUPPORTED
  jsonFileNameList.add("petstore.json");
  jsonFileNameList.add("uspto.json");
  jsonFileNameList.add("webhook-example.json");

  String currentWorkingDirectory = Directory.current.path;
  jsonFileNameList.forEach((jsonFileName) async {
    print("FILE_NAME: $jsonFileName");
    String jsonPath = "$currentWorkingDirectory/example/json/$jsonFileName";
    OpenAPILoader openAPILoader = OpenAPILoader();
    OpenAPI openAPI = await openAPILoader.loadFromFile(jsonPath);
    print("title: ${openAPI.info.title}");
  });
}
1
likes
130
points
178
downloads

Publisher

verified publisherdjbird.top

Weekly Downloads

An OpenAPI JSON Spec Parser, fromJson and toJson

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

json_annotation

More

Packages that depend on openapi_dart