OpenApi.fromMap constructor

OpenApi.fromMap(
  1. YamlMap m
)

Implementation

factory OpenApi.fromMap(YamlMap m) {
  (m['components']['schemas'] as YamlMap)
      .map((key, value) => MapEntry<String, Component>(
          key, Component.fromMap(key, value, false)))
      .values
      .toList();
  final cs = (m['components']['schemas'] as YamlMap)
      .map((key, value) => MapEntry<String, Component>(
          key, Component.fromMap(key, value, true)))
      .values
      .toList();
  return OpenApi(
    servers:
        (m['servers'] as YamlList?)?.map((e) => Server.fromMap(e)).toList() ??
            [],
    tags: (m['tags'] as YamlList?)?.map((e) => Tag.fromMap(e)).toList() ?? [],
    paths: (m['paths'] as YamlMap?)
            ?.map((key, value) =>
                MapEntry<String, Path>(key, Path.fromMap(key, value)))
            .values
            .toList() ??
        [],
    components: cs,
  );
}